From 1acc696e65e8a6f2a2d2458cdbf936b183f792dd Mon Sep 17 00:00:00 2001 From: Theodore Chang Date: Sun, 13 Aug 2023 22:15:13 -0400 Subject: [PATCH] Compute migration to track 1 deprecation (#21949) * add compute.sdk project reference * add sdk folder * address comments * update commit version to inputs * rename Compute.Sdk folder to Compute.Management.Sdk * resolve xmls, change compute.sdk reference to compute.management.sdk * remove SDK reference. generate track 1 with latest DiskRP version * Update src/Compute/Compute.Management.Sdk/README.md Co-authored-by: Vincent Dai <23257217+vidai-msft@users.noreply.github.com> * fix autorest cmd * update autorest gen * Update Compute.Management.Sdk.csproj * generated with latest swagger versions. 2023-04-02 diskRP 2023-07-01 CRP * update assembly version of sdk --------- Co-authored-by: Theodore Chang Co-authored-by: Vincent Dai <23257217+vidai-msft@users.noreply.github.com> --- .../Compute.Management.Sdk.csproj | 18 + .../Customizations/CapacityReservation.cs | 39 + .../CapacityReservationUpdate.cs | 37 + .../CapacityReservationUtilization.cs | 26 + .../CloudServiceNetworkProfile.cs | 17 + .../Customizations/DedicatedHostGroup.cs | 22 + .../DedicatedHostGroupUpdate.cs | 22 + .../Customizations/Disk.cs | 177 + .../DiskEncryptionSetParameters .cs | 18 + .../Customizations/DiskEncryptionSetUpdate.cs | 48 + .../Customizations/DiskRestorePoint.cs | 49 + .../Customizations/DiskUpdate.cs | 190 + .../Customizations/GalleriesOperations.cs | 284 + .../GalleriesOperationsExtensions.cs | 58 + .../GalleryApplicationVersion.cs | 24 + ...leryApplicationVersionPublishingProfile.cs | 32 + .../GalleryApplicationVersionUpdate.cs | 23 + .../Customizations/GalleryImageVersion.cs | 26 + .../GalleryImageVersionUpdate.cs | 25 + .../Customizations/IGalleriesOperations.cs | 87 + .../Customizations/IResourceSkusOperations.cs | 20 + .../IRestorePointsOperations.cs | 15 + .../IVirtualMachineScaleSetVMsOperations.cs | 30 + .../IVirtualMachineScaleSetsOperations.cs | 90 + .../IVirtualMachinesOperations.cs | 108 + .../Customizations/ImageDiskReference.cs | 39 + .../NetworkInterfaceReference.cs | 19 + .../Customizations/ResourceSkusOperations.cs | 29 + .../Customizations/RestorePointsOperations.cs | 187 + .../Customizations/Snapshot.cs | 152 + .../Customizations/SnapshotUpdate.cs | 103 + .../SubResourceWithColocationStatus.cs | 20 + .../Customizations/SupportedCapabilities.cs | 21 + .../Customizations/VirtualMachine.cs | 581 ++ .../VirtualMachineCaptureResult.cs | 21 + .../Customizations/VirtualMachineImage.cs | 88 + ...ualMachineNetworkInterfaceConfiguration.cs | 37 + .../VirtualMachineRunCommand.cs | 28 + .../VirtualMachineRunCommandUpdate.cs | 29 + .../Customizations/VirtualMachineScaleSet.cs | 456 ++ .../VirtualMachineScaleSetExtensionUpdate.cs | 27 + .../VirtualMachineScaleSetIPConfiguration.cs | 26 + ...tualMachineScaleSetNetworkConfiguration.cs | 53 + ...VirtualMachineScaleSetReimageParameters.cs | 30 + .../VirtualMachineScaleSetUpdate.cs | 29 + ...ualMachineScaleSetUpdateIPConfiguration.cs | 23 + ...chineScaleSetUpdateNetworkConfiguration.cs | 53 + ...leSetUpdatePublicIPAddressConfiguration.cs | 21 + .../VirtualMachineScaleSetVM.cs | 198 + .../VirtualMachineScaleSetVMExtension.cs | 71 + ...VirtualMachineScaleSetVMExtensionUpdate.cs | 30 + .../VirtualMachineScaleSetVMsOperations.cs | 602 ++ ...lMachineScaleSetVMsOperationsExtensions.cs | 46 + .../VirtualMachineScaleSetsOperations.cs | 933 +++ ...ualMachineScaleSetsOperationsExtensions.cs | 69 + .../Customizations/VirtualMachineUpdate.cs | 778 +++ .../VirtualMachinesOperations.cs | 618 ++ .../VirtualMachinesOperationsExtensions.cs | 125 + .../Generated/AvailabilitySetsOperations.cs | 1752 +++++ .../AvailabilitySetsOperationsExtensions.cs | 376 + .../CapacityReservationGroupsOperations.cs | 1620 +++++ ...tyReservationGroupsOperationsExtensions.cs | 402 ++ .../CapacityReservationsOperations.cs | 1368 ++++ ...apacityReservationsOperationsExtensions.cs | 479 ++ .../CloudServiceOperatingSystemsOperations.cs | 1172 ++++ ...iceOperatingSystemsOperationsExtensions.cs | 269 + .../CloudServiceRoleInstancesOperations.cs | 1881 +++++ ...erviceRoleInstancesOperationsExtensions.cs | 631 ++ .../Generated/CloudServiceRolesOperations.cs | 628 ++ .../CloudServiceRolesOperationsExtensions.cs | 153 + .../Generated/CloudServicesOperations.cs | 3122 +++++++++ .../CloudServicesOperationsExtensions.cs | 1047 +++ .../CloudServicesUpdateDomainOperations.cs | 839 +++ ...ervicesUpdateDomainOperationsExtensions.cs | 247 + .../Generated/CommunityGalleriesOperations.cs | 248 + .../CommunityGalleriesOperationsExtensions.cs | 65 + ...CommunityGalleryImageVersionsOperations.cs | 645 ++ ...alleryImageVersionsOperationsExtensions.cs | 163 + .../CommunityGalleryImagesOperations.cs | 624 ++ ...munityGalleryImagesOperationsExtensions.cs | 145 + .../Generated/ComputeManagementClient.cs | 641 ++ .../DedicatedHostGroupsOperations.cs | 1587 +++++ ...DedicatedHostGroupsOperationsExtensions.cs | 356 + .../Generated/DedicatedHostsOperations.cs | 1794 +++++ .../DedicatedHostsOperationsExtensions.cs | 617 ++ .../Generated/DiskAccessesOperations.cs | 2944 ++++++++ .../DiskAccessesOperationsExtensions.cs | 903 +++ .../Generated/DiskEncryptionSetsOperations.cs | 2051 ++++++ .../DiskEncryptionSetsOperationsExtensions.cs | 583 ++ .../Generated/DiskRestorePointOperations.cs | 1128 +++ .../DiskRestorePointOperationsExtensions.cs | 383 ++ .../Generated/DisksOperations.cs | 2110 ++++++ .../Generated/DisksOperationsExtensions.cs | 663 ++ .../Generated/GalleriesOperations.cs | 1682 +++++ .../GalleriesOperationsExtensions.cs | 485 ++ .../GalleryApplicationVersionsOperations.cs | 1454 ++++ ...ApplicationVersionsOperationsExtensions.cs | 555 ++ .../GalleryApplicationsOperations.cs | 1377 ++++ ...GalleryApplicationsOperationsExtensions.cs | 471 ++ .../GalleryImageVersionsOperations.cs | 1446 ++++ ...alleryImageVersionsOperationsExtensions.cs | 539 ++ .../Generated/GalleryImagesOperations.cs | 1377 ++++ .../GalleryImagesOperationsExtensions.cs | 471 ++ .../GallerySharingProfileOperations.cs | 309 + ...llerySharingProfileOperationsExtensions.cs | 117 + .../Generated/IAvailabilitySetsOperations.cs | 245 + .../ICapacityReservationGroupsOperations.cs | 255 + .../ICapacityReservationsOperations.cs | 300 + ...ICloudServiceOperatingSystemsOperations.cs | 185 + .../ICloudServiceRoleInstancesOperations.cs | 388 ++ .../Generated/ICloudServiceRolesOperations.cs | 106 + .../Generated/ICloudServicesOperations.cs | 638 ++ .../ICloudServicesUpdateDomainOperations.cs | 160 + .../ICommunityGalleriesOperations.cs | 52 + ...CommunityGalleryImageVersionsOperations.cs | 111 + .../ICommunityGalleryImagesOperations.cs | 102 + .../Generated/IComputeManagementClient.cs | 314 + .../IDedicatedHostGroupsOperations.cs | 232 + .../Generated/IDedicatedHostsOperations.cs | 378 ++ .../Generated/IDiskAccessesOperations.cs | 558 ++ .../IDiskEncryptionSetsOperations.cs | 370 + .../Generated/IDiskRestorePointOperations.cs | 246 + .../Generated/IDisksOperations.cs | 428 ++ .../Generated/IGalleriesOperations.cs | 311 + .../IGalleryApplicationVersionsOperations.cs | 342 + .../IGalleryApplicationsOperations.cs | 296 + .../IGalleryImageVersionsOperations.cs | 338 + .../Generated/IGalleryImagesOperations.cs | 296 + .../IGallerySharingProfileOperations.cs | 83 + .../Generated/IImagesOperations.cs | 304 + .../Generated/ILogAnalyticsOperations.cs | 133 + .../Generated/IOperations.cs | 46 + .../IProximityPlacementGroupsOperations.cs | 220 + .../Generated/IResourceSkusOperations.cs | 77 + .../IRestorePointCollectionsOperations.cs | 255 + .../Generated/IRestorePointsOperations.cs | 174 + .../Generated/ISharedGalleriesOperations.cs | 100 + .../ISharedGalleryImageVersionsOperations.cs | 118 + .../ISharedGalleryImagesOperations.cs | 107 + .../Generated/ISnapshotsOperations.cs | 430 ++ .../Generated/ISshPublicKeysOperations.cs | 251 + .../Generated/IUsageOperations.cs | 75 + ...VirtualMachineExtensionImagesOperations.cs | 109 + .../IVirtualMachineExtensionsOperations.cs | 270 + ...IVirtualMachineImagesEdgeZoneOperations.cs | 197 + .../IVirtualMachineImagesOperations.cs | 204 + .../IVirtualMachineRunCommandsOperations.cs | 361 + ...tualMachineScaleSetExtensionsOperations.cs | 281 + ...achineScaleSetRollingUpgradesOperations.cs | 197 + ...alMachineScaleSetVMExtensionsOperations.cs | 289 + ...lMachineScaleSetVMRunCommandsOperations.cs | 312 + .../IVirtualMachineScaleSetVMsOperations.cs | 827 +++ .../IVirtualMachineScaleSetsOperations.cs | 1235 ++++ .../IVirtualMachineSizesOperations.cs | 50 + .../Generated/IVirtualMachinesOperations.cs | 1195 ++++ .../Generated/ImagesOperations.cs | 1672 +++++ .../Generated/ImagesOperationsExtensions.cs | 475 ++ .../Generated/LogAnalyticsOperations.cs | 522 ++ .../LogAnalyticsOperationsExtensions.cs | 193 + .../Generated/Models/AccessLevel.cs | 23 + .../Generated/Models/AccessUri.cs | 60 + .../Models/AdditionalCapabilities.cs | 70 + .../Models/AdditionalUnattendContent.cs | 95 + .../Models/AggregatedReplicationState.cs | 24 + .../Generated/Models/AlternativeOption.cs | 66 + .../Generated/Models/AlternativeType.cs | 23 + .../Generated/Models/ApiEntityReference.cs | 53 + .../Generated/Models/ApiError.cs | 85 + .../Generated/Models/ApiErrorBase.cs | 67 + .../Generated/Models/ApplicationProfile.cs | 56 + .../Generated/Models/Architecture.cs | 22 + .../Generated/Models/ArchitectureTypes.cs | 22 + .../Models/AutomaticOSUpgradePolicy.cs | 86 + .../Models/AutomaticOSUpgradeProperties.cs | 65 + .../Models/AutomaticRepairsPolicy.cs | 89 + .../Generated/Models/AvailabilitySet.cs | 136 + .../Models/AvailabilitySetSkuTypes.cs | 22 + .../Generated/Models/AvailabilitySetUpdate.cs | 106 + .../Generated/Models/AvailablePatchSummary.cs | 134 + .../Generated/Models/BillingProfile.cs | 86 + .../Generated/Models/BootDiagnostics.cs | 69 + .../Models/BootDiagnosticsInstanceView.cs | 81 + .../Generated/Models/CachingTypes.cs | 66 + .../Generated/Models/CapacityReservation.cs | 186 + .../Models/CapacityReservationGroup.cs | 118 + .../CapacityReservationGroupInstanceView.cs | 54 + ...pacityReservationGroupInstanceViewTypes.cs | 21 + .../Models/CapacityReservationGroupUpdate.cs | 87 + .../Models/CapacityReservationInstanceView.cs | 66 + .../CapacityReservationInstanceViewTypes.cs | 21 + ...CapacityReservationInstanceViewWithName.cs | 61 + .../Models/CapacityReservationProfile.cs | 58 + .../Models/CapacityReservationUpdate.cs | 149 + .../Models/CapacityReservationUtilization.cs | 72 + .../Generated/Models/CloudService.cs | 124 + .../Models/CloudServiceExtensionProfile.cs | 56 + .../Models/CloudServiceExtensionProperties.cs | 179 + .../Models/CloudServiceInstanceView.cs | 82 + .../Models/CloudServiceNetworkProfile.cs | 83 + .../Generated/Models/CloudServiceOsProfile.cs | 55 + .../Models/CloudServiceProperties.cs | 173 + .../Generated/Models/CloudServiceRole.cs | 87 + .../Models/CloudServiceRoleProfile.cs | 53 + .../CloudServiceRoleProfileProperties.cs | 59 + .../Models/CloudServiceRoleProperties.cs | 53 + .../Generated/Models/CloudServiceRoleSku.cs | 78 + .../Generated/Models/CloudServiceSlotType.cs | 22 + .../Generated/Models/CloudServiceUpdate.cs | 50 + .../Models/CloudServiceUpgradeMode.cs | 23 + .../CloudServiceVaultAndSecretReference.cs | 65 + .../Models/CloudServiceVaultCertificate.cs | 56 + .../Models/CloudServiceVaultSecretGroup.cs | 67 + .../Generated/Models/CommunityGallery.cs | 49 + .../Generated/Models/CommunityGalleryImage.cs | 183 + .../Models/CommunityGalleryImageIdentifier.cs | 72 + .../Models/CommunityGalleryImageVersion.cs | 100 + .../Generated/Models/CommunityGalleryInfo.cs | 106 + .../Generated/Models/ComponentNames.cs | 54 + .../Generated/Models/ComputeOperationValue.cs | 97 + .../Models/ConfidentialVMEncryptionType.cs | 23 + .../Generated/Models/ConsistencyModeTypes.cs | 23 + .../Generated/Models/CopyCompletionError.cs | 83 + .../Generated/Models/CreationData.cs | 198 + .../Generated/Models/DataAccessAuthMode.cs | 31 + .../Generated/Models/DataDisk.cs | 263 + .../Generated/Models/DataDiskImage.cs | 56 + .../Models/DataDiskImageEncryption.cs | 70 + .../Generated/Models/DedicatedHost.cs | 185 + .../Models/DedicatedHostAllocatableVM.cs | 64 + .../Models/DedicatedHostAvailableCapacity.cs | 59 + .../Generated/Models/DedicatedHostGroup.cs | 147 + .../Models/DedicatedHostGroupInstanceView.cs | 54 + ...stGroupPropertiesAdditionalCapabilities.cs | 72 + .../Models/DedicatedHostGroupUpdate.cs | 140 + .../Models/DedicatedHostInstanceView.cs | 72 + .../DedicatedHostInstanceViewWithName.cs | 63 + .../Models/DedicatedHostLicenseTypes.cs | 66 + .../Generated/Models/DedicatedHostUpdate.cs | 180 + .../Generated/Models/DeleteOptions.cs | 22 + .../Generated/Models/DiagnosticsProfile.cs | 63 + .../Generated/Models/DiffDiskOptions.cs | 21 + .../Generated/Models/DiffDiskPlacement.cs | 22 + .../Generated/Models/DiffDiskSettings.cs | 81 + .../Generated/Models/Disallowed.cs | 53 + .../Models/DisallowedConfiguration.cs | 53 + .../Generated/Models/Disk.cs | 493 ++ .../Generated/Models/DiskAccess.cs | 114 + .../Generated/Models/DiskAccessUpdate.cs | 53 + .../Generated/Models/DiskControllerTypes.cs | 22 + .../Generated/Models/DiskCreateOption.cs | 75 + .../Generated/Models/DiskCreateOptionTypes.cs | 23 + .../Generated/Models/DiskDeleteOptionTypes.cs | 22 + .../Generated/Models/DiskDetachOptionTypes.cs | 21 + .../Generated/Models/DiskEncryptionSet.cs | 176 + .../Models/DiskEncryptionSetIdentityType.cs | 24 + .../Models/DiskEncryptionSetParameters.cs | 41 + .../Generated/Models/DiskEncryptionSetType.cs | 36 + .../Models/DiskEncryptionSetUpdate.cs | 118 + .../Models/DiskEncryptionSettings.cs | 90 + .../Generated/Models/DiskImageEncryption.cs | 53 + .../Generated/Models/DiskInstanceView.cs | 73 + .../Generated/Models/DiskRestorePoint.cs | 231 + .../Models/DiskRestorePointAttributes.cs | 60 + .../Models/DiskRestorePointInstanceView.cs | 62 + .../DiskRestorePointReplicationStatus.cs | 62 + .../Generated/Models/DiskSecurityProfile.cs | 69 + .../Generated/Models/DiskSecurityTypes.cs | 39 + .../Generated/Models/DiskSku.cs | 64 + .../Generated/Models/DiskState.cs | 55 + .../Models/DiskStorageAccountTypes.cs | 58 + .../Generated/Models/DiskUpdate.cs | 313 + .../Models/DomainNameLabelScopeTypes.cs | 24 + .../Models/EdgeZoneStorageAccountType.cs | 24 + .../Generated/Models/Encryption.cs | 67 + .../Generated/Models/EncryptionImages.cs | 62 + .../Generated/Models/EncryptionSetIdentity.cs | 107 + .../Models/EncryptionSettingsCollection.cs | 107 + .../Models/EncryptionSettingsElement.cs | 82 + .../Generated/Models/EncryptionType.cs | 36 + .../Generated/Models/ExecutionState.cs | 27 + .../Generated/Models/ExpandTypeForListVMs.cs | 21 + ...andTypesForGetCapacityReservationGroups.cs | 22 + .../Models/ExpandTypesForGetVMScaleSets.cs | 21 + .../Generated/Models/ExpandTypesForListVMs.cs | 21 + .../Generated/Models/ExtendedLocation.cs | 61 + .../Generated/Models/ExtendedLocationType.cs | 21 + .../Generated/Models/ExtendedLocationTypes.cs | 21 + .../Generated/Models/Extension.cs | 57 + .../Generated/Models/FileFormat.cs | 30 + .../Generated/Models/Gallery.cs | 110 + .../Generated/Models/GalleryApplication.cs | 154 + .../Models/GalleryApplicationCustomAction.cs | 114 + ...GalleryApplicationCustomActionParameter.cs | 114 + ...eryApplicationCustomActionParameterType.cs | 66 + .../Models/GalleryApplicationUpdate.cs | 152 + .../Models/GalleryApplicationVersion.cs | 102 + ...leryApplicationVersionPublishingProfile.cs | 154 + .../GalleryApplicationVersionSafetyProfile.cs | 48 + .../Models/GalleryApplicationVersionUpdate.cs | 102 + .../GalleryArtifactPublishingProfileBase.cs | 141 + .../GalleryArtifactSafetyProfileBase.cs | 56 + .../Generated/Models/GalleryArtifactSource.cs | 67 + .../GalleryArtifactVersionFullSource.cs | 60 + .../Models/GalleryArtifactVersionSource.cs | 57 + .../Generated/Models/GalleryDataDiskImage.cs | 73 + .../Generated/Models/GalleryDiskImage.cs | 70 + .../Models/GalleryDiskImageSource.cs | 68 + .../Generated/Models/GalleryExpandParams.cs | 21 + .../Models/GalleryExtendedLocation.cs | 58 + .../Models/GalleryExtendedLocationType.cs | 22 + .../Generated/Models/GalleryIdentifier.cs | 53 + .../Generated/Models/GalleryImage.cs | 215 + .../Generated/Models/GalleryImageFeature.cs | 59 + .../Models/GalleryImageIdentifier.cs | 92 + .../Generated/Models/GalleryImageUpdate.cs | 213 + .../Generated/Models/GalleryImageVersion.cs | 104 + .../GalleryImageVersionPublishingProfile.cs | 72 + .../GalleryImageVersionSafetyProfile.cs | 71 + .../GalleryImageVersionStorageProfile.cs | 67 + .../Models/GalleryImageVersionUpdate.cs | 102 + .../Generated/Models/GalleryOSDiskImage.cs | 48 + .../Models/GalleryProvisioningState.cs | 26 + .../Models/GallerySharingPermissionTypes.cs | 23 + .../Models/GalleryTargetExtendedLocation.cs | 86 + .../Generated/Models/GalleryUpdate.cs | 99 + .../Generated/Models/GrantAccessData.cs | 97 + .../Generated/Models/HardwareProfile.cs | 194 + .../Generated/Models/HostCaching.cs | 66 + .../Generated/Models/HyperVGeneration.cs | 22 + .../Generated/Models/HyperVGenerationType.cs | 22 + .../Generated/Models/HyperVGenerationTypes.cs | 22 + .../Generated/Models/IPVersion.cs | 22 + .../Generated/Models/IPVersions.cs | 22 + .../Generated/Models/Image.cs | 127 + .../Generated/Models/ImageDataDisk.cs | 86 + .../Models/ImageDeprecationStatus.cs | 72 + .../Generated/Models/ImageDisk.cs | 121 + .../Generated/Models/ImageDiskReference.cs | 86 + .../Generated/Models/ImageOSDisk.cs | 97 + .../Generated/Models/ImagePurchasePlan.cs | 68 + .../Generated/Models/ImageReference.cs | 143 + .../Generated/Models/ImageState.cs | 23 + .../Generated/Models/ImageStorageProfile.cs | 113 + .../Generated/Models/ImageUpdate.cs | 111 + .../Generated/Models/InnerError.cs | 60 + .../Generated/Models/InstanceSku.cs | 60 + .../Generated/Models/InstanceViewStatus.cs | 88 + .../Models/InstanceViewStatusesSummary.cs | 55 + .../Generated/Models/InstanceViewTypes.cs | 60 + .../Generated/Models/IntervalInMins.cs | 72 + .../Models/KeyForDiskEncryptionSet.cs | 84 + .../Models/KeyVaultAndKeyReference.cs | 81 + .../Models/KeyVaultAndSecretReference.cs | 80 + .../Generated/Models/KeyVaultKeyReference.cs | 79 + .../Models/KeyVaultSecretReference.cs | 80 + .../Models/LastPatchInstallationSummary.cs | 165 + .../Models/LatestGalleryImageVersion.cs | 60 + .../Generated/Models/LinuxConfiguration.cs | 102 + .../Generated/Models/LinuxParameters.cs | 85 + .../Models/LinuxPatchAssessmentMode.cs | 22 + .../Generated/Models/LinuxPatchSettings.cs | 102 + ...stPatchAutomaticByPlatformRebootSetting.cs | 24 + ...VMGuestPatchAutomaticByPlatformSettings.cs | 68 + .../Generated/Models/LinuxVMGuestPatchMode.cs | 22 + .../Models/LoadBalancerConfiguration.cs | 90 + .../LoadBalancerConfigurationProperties.cs | 85 + .../LoadBalancerFrontendIpConfiguration.cs | 86 + ...lancerFrontendIpConfigurationProperties.cs | 73 + .../Generated/Models/LogAnalyticsInputBase.cs | 128 + .../Models/LogAnalyticsOperationResult.cs | 53 + .../Generated/Models/LogAnalyticsOutput.cs | 52 + .../MaintenanceOperationResultCodeTypes.cs | 72 + .../Models/MaintenanceRedeployStatus.cs | 109 + .../Generated/Models/ManagedArtifact.cs | 65 + .../Generated/Models/ManagedDiskParameters.cs | 80 + .../Generated/Models/NetworkAccessPolicy.cs | 33 + .../Generated/Models/NetworkApiVersion.cs | 21 + .../Models/NetworkInterfaceAuxiliaryMode.cs | 23 + .../Models/NetworkInterfaceAuxiliarySku.cs | 25 + .../Models/NetworkInterfaceReference.cs | 68 + .../Generated/Models/NetworkProfile.cs | 81 + .../Generated/Models/OSDisk.cs | 225 + .../Generated/Models/OSDiskImage.cs | 62 + .../Generated/Models/OSDiskImageEncryption.cs | 56 + .../Models/OSDiskImageSecurityProfile.cs | 65 + .../Generated/Models/OSFamily.cs | 81 + .../Generated/Models/OSFamilyProperties.cs | 70 + .../Models/OSImageNotificationProfile.cs | 66 + .../Generated/Models/OSProfile.cs | 240 + .../Models/OSProfileProvisioningData.cs | 119 + .../Generated/Models/OSVersion.cs | 81 + .../Generated/Models/OSVersionProperties.cs | 95 + .../Models/OSVersionPropertiesBase.cs | 78 + .../Models/OperatingSystemStateTypes.cs | 66 + .../Generated/Models/OperatingSystemType.cs | 22 + .../Generated/Models/OperatingSystemTypes.cs | 60 + .../Generated/Models/OrchestrationMode.cs | 22 + .../Models/OrchestrationServiceNames.cs | 22 + .../Models/OrchestrationServiceState.cs | 23 + .../Models/OrchestrationServiceStateAction.cs | 22 + .../Models/OrchestrationServiceStateInput.cs | 84 + .../Models/OrchestrationServiceSummary.cs | 67 + .../Generated/Models/Page.cs | 53 + .../Generated/Models/Page1.cs | 53 + .../Generated/Models/PassNames.cs | 54 + .../Generated/Models/PatchAssessmentState.cs | 22 + .../Models/PatchInstallationDetail.cs | 104 + .../Models/PatchInstallationState.cs | 26 + .../Generated/Models/PatchOperationStatus.cs | 25 + .../Generated/Models/PatchSettings.cs | 129 + .../Models/PirCommunityGalleryResource.cs | 81 + .../Generated/Models/PirResource.cs | 59 + .../Models/PirSharedGalleryResource.cs | 58 + .../Generated/Models/Plan.cs | 85 + .../Generated/Models/PolicyViolation.cs | 65 + .../Models/PolicyViolationCategory.cs | 24 + .../Generated/Models/PriorityMixPolicy.cs | 98 + .../Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 116 + ...vateEndpointConnectionProvisioningState.cs | 24 + .../PrivateEndpointServiceConnectionStatus.cs | 23 + .../Generated/Models/PrivateLinkResource.cs | 98 + .../Models/PrivateLinkResourceListResult.cs | 55 + .../PrivateLinkServiceConnectionState.cs | 77 + .../Models/PropertyUpdatesInProgress.cs | 53 + .../Generated/Models/ProtocolTypes.cs | 60 + .../Models/ProximityPlacementGroup.cs | 142 + ...ProximityPlacementGroupPropertiesIntent.cs | 57 + .../Models/ProximityPlacementGroupType.cs | 22 + .../Models/ProximityPlacementGroupUpdate.cs | 48 + .../Generated/Models/ProxyOnlyResource.cs | 67 + .../Generated/Models/ProxyResource.cs | 70 + .../Generated/Models/PublicIPAddressSku.cs | 64 + .../Models/PublicIPAddressSkuName.cs | 22 + .../Models/PublicIPAddressSkuTier.cs | 22 + .../Models/PublicIPAllocationMethod.cs | 22 + .../Generated/Models/PublicNetworkAccess.cs | 34 + .../Generated/Models/PurchasePlan.cs | 102 + .../Models/RecommendedMachineConfiguration.cs | 58 + .../Generated/Models/RecoveryWalkResponse.cs | 63 + .../Models/RegionalReplicationStatus.cs | 82 + .../Generated/Models/RegionalSharingStatus.cs | 71 + .../Generated/Models/RepairAction.cs | 23 + .../Generated/Models/ReplicationMode.cs | 22 + .../Generated/Models/ReplicationState.cs | 24 + .../Generated/Models/ReplicationStatus.cs | 67 + .../Models/ReplicationStatusTypes.cs | 21 + .../Models/RequestRateByIntervalInput.cs | 80 + .../Generated/Models/Resource.cs | 100 + .../Generated/Models/ResourceIdentityType.cs | 72 + .../Models/ResourceInstanceViewStatus.cs | 88 + .../Generated/Models/ResourceRange.cs | 59 + .../Generated/Models/ResourceSku.cs | 165 + .../Models/ResourceSkuCapabilities.cs | 60 + .../Generated/Models/ResourceSkuCapacity.cs | 77 + .../Models/ResourceSkuCapacityScaleType.cs | 66 + .../Generated/Models/ResourceSkuCosts.cs | 70 + .../Models/ResourceSkuLocationInfo.cs | 90 + .../Models/ResourceSkuRestrictionInfo.cs | 63 + .../Models/ResourceSkuRestrictions.cs | 87 + .../ResourceSkuRestrictionsReasonCode.cs | 60 + .../Models/ResourceSkuRestrictionsType.cs | 60 + .../Models/ResourceSkuZoneDetails.cs | 65 + .../Models/ResourceWithOptionalLocation.cs | 89 + .../Generated/Models/RestorePoint.cs | 141 + .../Models/RestorePointCollection.cs | 108 + .../RestorePointCollectionExpandOptions.cs | 21 + .../RestorePointCollectionSourceProperties.cs | 66 + .../Models/RestorePointCollectionUpdate.cs | 86 + .../Models/RestorePointEncryption.cs | 65 + .../Models/RestorePointEncryptionType.cs | 35 + .../Models/RestorePointExpandOptions.cs | 21 + .../Models/RestorePointInstanceView.cs | 62 + .../Models/RestorePointSourceMetadata.cs | 149 + .../Models/RestorePointSourceVMDataDisk.cs | 109 + .../Models/RestorePointSourceVMOSDisk.cs | 127 + .../RestorePointSourceVMStorageProfile.cs | 80 + .../RetrieveBootDiagnosticsDataResult.cs | 63 + .../Generated/Models/RoleInstance.cs | 97 + .../Models/RoleInstanceInstanceView.cs | 83 + .../Models/RoleInstanceNetworkProfile.cs | 56 + .../Models/RoleInstanceProperties.cs | 55 + .../Generated/Models/RoleInstances.cs | 70 + .../Generated/Models/RollbackStatusInfo.cs | 72 + .../Models/RollingUpgradeActionType.cs | 60 + .../Generated/Models/RollingUpgradePolicy.cs | 201 + .../Models/RollingUpgradeProgressInfo.cs | 82 + .../Models/RollingUpgradeRunningStatus.cs | 84 + .../Models/RollingUpgradeStatusCode.cs | 72 + .../Models/RollingUpgradeStatusInfo.cs | 106 + .../Generated/Models/RunCommandDocument.cs | 93 + .../Models/RunCommandDocumentBase.cs | 111 + .../Generated/Models/RunCommandInput.cs | 97 + .../Models/RunCommandInputParameter.cs | 77 + .../Models/RunCommandManagedIdentity.cs | 75 + .../Models/RunCommandParameterDefinition.cs | 96 + .../Generated/Models/RunCommandResult.cs | 50 + .../Generated/Models/ScaleInPolicy.cs | 105 + .../Models/ScheduledEventsProfile.cs | 60 + .../Models/SecurityEncryptionTypes.cs | 22 + .../Models/SecurityPostureReference.cs | 66 + .../Generated/Models/SecurityProfile.cs | 91 + .../Generated/Models/SecurityTypes.cs | 22 + .../Generated/Models/SelectPermissions.cs | 21 + .../Models/ServiceArtifactReference.cs | 55 + .../Generated/Models/SettingNames.cs | 60 + .../Generated/Models/ShareInfoElement.cs | 50 + .../Generated/Models/SharedGallery.cs | 48 + .../Models/SharedGalleryDataDiskImage.cs | 73 + .../Models/SharedGalleryDiskImage.cs | 64 + .../Models/SharedGalleryHostCaching.cs | 23 + .../Generated/Models/SharedGalleryImage.cs | 186 + .../Models/SharedGalleryImageVersion.cs | 97 + ...SharedGalleryImageVersionStorageProfile.cs | 61 + .../Models/SharedGalleryOSDiskImage.cs | 48 + .../Generated/Models/SharedToValues.cs | 21 + .../Generated/Models/SharingProfile.cs | 80 + .../Generated/Models/SharingProfileGroup.cs | 71 + .../Models/SharingProfileGroupTypes.cs | 22 + .../Generated/Models/SharingState.cs | 24 + .../Generated/Models/SharingStatus.cs | 65 + .../Generated/Models/SharingUpdate.cs | 86 + .../Models/SharingUpdateOperationTypes.cs | 24 + .../Generated/Models/Sku.cs | 77 + .../Generated/Models/Snapshot.cs | 357 + .../Generated/Models/SnapshotSku.cs | 64 + .../Models/SnapshotStorageAccountTypes.cs | 32 + .../Generated/Models/SnapshotUpdate.cs | 183 + .../Generated/Models/SoftDeletePolicy.cs | 54 + .../Generated/Models/SourceVault.cs | 52 + .../Generated/Models/SpotRestorePolicy.cs | 71 + .../Generated/Models/SshConfiguration.cs | 55 + .../Generated/Models/SshPublicKey.cs | 73 + .../SshPublicKeyGenerateKeyPairResult.cs | 102 + .../Generated/Models/SshPublicKeyResource.cs | 82 + .../Models/SshPublicKeyUpdateResource.cs | 68 + .../Generated/Models/StatusCodeCount.cs | 60 + .../Generated/Models/StatusLevelTypes.cs | 66 + .../Generated/Models/StorageAccountType.cs | 23 + .../Generated/Models/StorageAccountTypes.cs | 27 + .../Generated/Models/StorageProfile.cs | 139 + .../Generated/Models/SubResource.cs | 48 + .../Generated/Models/SubResourceReadOnly.cs | 48 + .../Models/SubResourceWithColocationStatus.cs | 54 + .../Generated/Models/SupportedCapabilities.cs | 75 + .../Generated/Models/SystemData.cs | 67 + .../Generated/Models/TargetRegion.cs | 105 + .../Models/TerminateNotificationProfile.cs | 68 + .../Models/ThrottledRequestsInput.cs | 67 + .../Generated/Models/UefiSettings.cs | 65 + .../Generated/Models/UpdateDomain.cs | 59 + .../Generated/Models/UpdateResource.cs | 53 + .../Models/UpdateResourceDefinition.cs | 79 + .../Generated/Models/UpgradeMode.cs | 66 + .../UpgradeOperationHistoricalStatusInfo.cs | 70 + ...OperationHistoricalStatusInfoProperties.cs | 98 + .../Models/UpgradeOperationHistoryStatus.cs | 73 + .../Models/UpgradeOperationInvoker.cs | 66 + .../Generated/Models/UpgradePolicy.cs | 98 + .../Generated/Models/UpgradeState.cs | 72 + .../Generated/Models/Usage.cs | 96 + .../Generated/Models/UsageName.cs | 60 + .../Generated/Models/UserArtifactManage.cs | 95 + .../Generated/Models/UserArtifactSettings.cs | 72 + .../Generated/Models/UserArtifactSource.cs | 78 + .../Models/UserAssignedIdentitiesValue.cs | 60 + .../Generated/Models/VMDiskSecurityProfile.cs | 75 + .../Generated/Models/VMGalleryApplication.cs | 124 + .../Models/VMGuestPatchClassificationLinux.cs | 23 + .../VMGuestPatchClassificationWindows.cs | 28 + .../Models/VMGuestPatchRebootBehavior.cs | 24 + .../Models/VMGuestPatchRebootSetting.cs | 23 + .../Models/VMGuestPatchRebootStatus.cs | 26 + ...leSetConvertToSinglePlacementGroupInput.cs | 58 + .../Generated/Models/VMSizeProperties.cs | 82 + .../Generated/Models/VaultCertificate.cs | 104 + .../Generated/Models/VaultSecretGroup.cs | 65 + .../Generated/Models/VirtualHardDisk.cs | 51 + .../Generated/Models/VirtualMachine.cs | 507 ++ .../Models/VirtualMachineAgentInstanceView.cs | 72 + .../VirtualMachineAssessPatchesResult.cs | 138 + .../Models/VirtualMachineCaptureParameters.cs | 91 + .../Models/VirtualMachineCaptureResult.cs | 84 + .../VirtualMachineEvictionPolicyTypes.cs | 22 + .../Models/VirtualMachineExtension.cs | 206 + ...tualMachineExtensionHandlerInstanceView.cs | 72 + .../Models/VirtualMachineExtensionImage.cs | 132 + .../VirtualMachineExtensionInstanceView.cs | 90 + .../Models/VirtualMachineExtensionUpdate.cs | 176 + .../VirtualMachineExtensionsListResult.cs | 55 + .../Models/VirtualMachineHealthStatus.cs | 52 + .../Models/VirtualMachineIdentity.cs | 99 + .../Generated/Models/VirtualMachineImage.cs | 145 + .../Models/VirtualMachineImageFeature.cs | 60 + .../Models/VirtualMachineImageResource.cs | 107 + .../VirtualMachineInstallPatchesParameters.cs | 103 + .../VirtualMachineInstallPatchesResult.cs | 179 + .../Models/VirtualMachineInstanceView.cs | 202 + .../Generated/Models/VirtualMachineIpTag.cs | 62 + ...ualMachineNetworkInterfaceConfiguration.cs | 205 + ...etworkInterfaceDnsSettingsConfiguration.cs | 55 + ...lMachineNetworkInterfaceIPConfiguration.cs | 159 + .../Models/VirtualMachinePatchStatus.cs | 75 + .../Models/VirtualMachinePriorityTypes.cs | 23 + ...tualMachinePublicIPAddressConfiguration.cs | 158 + ...PublicIPAddressDnsSettingsConfiguration.cs | 91 + .../Models/VirtualMachineReimageParameters.cs | 81 + .../Models/VirtualMachineRunCommand.cs | 286 + .../VirtualMachineRunCommandInstanceView.cs | 118 + .../VirtualMachineRunCommandScriptSource.cs | 100 + .../Models/VirtualMachineRunCommandUpdate.cs | 254 + .../Models/VirtualMachineScaleSet.cs | 351 + .../Models/VirtualMachineScaleSetDataDisk.cs | 191 + .../Models/VirtualMachineScaleSetExtension.cs | 213 + .../VirtualMachineScaleSetExtensionProfile.cs | 73 + .../VirtualMachineScaleSetExtensionUpdate.cs | 212 + .../VirtualMachineScaleSetHardwareProfile.cs | 60 + .../VirtualMachineScaleSetIPConfiguration.cs | 174 + .../Models/VirtualMachineScaleSetIdentity.cs | 102 + .../VirtualMachineScaleSetInstanceView.cs | 82 + ...hineScaleSetInstanceViewStatusesSummary.cs | 56 + .../Models/VirtualMachineScaleSetIpTag.cs | 64 + ...ualMachineScaleSetManagedDiskParameters.cs | 80 + ...tualMachineScaleSetNetworkConfiguration.cs | 199 + ...ScaleSetNetworkConfigurationDnsSettings.cs | 56 + .../VirtualMachineScaleSetNetworkProfile.cs | 85 + .../Models/VirtualMachineScaleSetOSDisk.cs | 213 + .../Models/VirtualMachineScaleSetOSProfile.cs | 221 + ...ineScaleSetPublicIPAddressConfiguration.cs | 147 + ...PublicIPAddressConfigurationDnsSettings.cs | 93 + ...VirtualMachineScaleSetReimageParameters.cs | 71 + .../VirtualMachineScaleSetScaleInRules.cs | 23 + .../Models/VirtualMachineScaleSetSku.cs | 69 + .../VirtualMachineScaleSetSkuCapacity.cs | 79 + .../VirtualMachineScaleSetSkuScaleType.cs | 60 + .../VirtualMachineScaleSetStorageProfile.cs | 124 + .../Models/VirtualMachineScaleSetUpdate.cs | 225 + ...ualMachineScaleSetUpdateIPConfiguration.cs | 155 + ...chineScaleSetUpdateNetworkConfiguration.cs | 171 + ...tualMachineScaleSetUpdateNetworkProfile.cs | 85 + .../VirtualMachineScaleSetUpdateOSDisk.cs | 144 + .../VirtualMachineScaleSetUpdateOSProfile.cs | 83 + ...leSetUpdatePublicIPAddressConfiguration.cs | 110 + ...tualMachineScaleSetUpdateStorageProfile.cs | 77 + .../VirtualMachineScaleSetUpdateVMProfile.cs | 151 + .../Models/VirtualMachineScaleSetVM.cs | 371 + .../VirtualMachineScaleSetVMExtension.cs | 227 + ...VirtualMachineScaleSetVMExtensionUpdate.cs | 189 + ...alMachineScaleSetVMExtensionsListResult.cs | 55 + ...rtualMachineScaleSetVMExtensionsSummary.cs | 63 + .../VirtualMachineScaleSetVMInstanceIDs.cs | 61 + ...ualMachineScaleSetVMInstanceRequiredIDs.cs | 70 + .../VirtualMachineScaleSetVMInstanceView.cs | 217 + ...neScaleSetVMNetworkProfileConfiguration.cs | 56 + .../Models/VirtualMachineScaleSetVMProfile.cs | 273 + ...irtualMachineScaleSetVMProtectionPolicy.cs | 69 + ...rtualMachineScaleSetVMReimageParameters.cs | 54 + .../VirtualMachineScaleSetsReapplyHeaders.cs | 51 + .../Generated/Models/VirtualMachineSize.cs | 110 + .../Models/VirtualMachineSizeTypes.cs | 186 + .../VirtualMachineSoftwarePatchProperties.cs | 143 + .../Models/VirtualMachineStatusCodeCount.cs | 63 + .../Generated/Models/VirtualMachineUpdate.cs | 474 ++ .../Generated/Models/VmDiskTypes.cs | 22 + .../Models/VmImagesInEdgeZoneListResult.cs | 67 + .../Generated/Models/WinRMConfiguration.cs | 54 + .../Generated/Models/WinRMListener.cs | 92 + .../Generated/Models/WindowsConfiguration.cs | 134 + .../Generated/Models/WindowsParameters.cs | 97 + .../Models/WindowsPatchAssessmentMode.cs | 22 + ...stPatchAutomaticByPlatformRebootSetting.cs | 24 + ...VMGuestPatchAutomaticByPlatformSettings.cs | 68 + .../Models/WindowsVMGuestPatchMode.cs | 23 + .../Generated/Operations.cs | 219 + .../Generated/OperationsExtensions.cs | 55 + .../ProximityPlacementGroupsOperations.cs | 1576 +++++ ...mityPlacementGroupsOperationsExtensions.cs | 334 + .../Generated/ResourceSkusOperations.cs | 420 ++ .../ResourceSkusOperationsExtensions.cs | 101 + .../RestorePointCollectionsOperations.cs | 1609 +++++ ...orePointCollectionsOperationsExtensions.cs | 393 ++ .../Generated/RestorePointsOperations.cs | 725 ++ .../RestorePointsOperationsExtensions.cs | 275 + .../SdkInfo_ComputeManagementClient.cs | 75 + .../Generated/SharedGalleriesOperations.cs | 615 ++ .../SharedGalleriesOperationsExtensions.cs | 141 + .../SharedGalleryImageVersionsOperations.cs | 656 ++ ...alleryImageVersionsOperationsExtensions.cs | 175 + .../SharedGalleryImagesOperations.cs | 634 ++ ...SharedGalleryImagesOperationsExtensions.cs | 155 + .../Generated/SnapshotsOperations.cs | 2112 ++++++ .../SnapshotsOperationsExtensions.cs | 667 ++ .../Generated/SshPublicKeysOperations.cs | 1767 +++++ .../SshPublicKeysOperationsExtensions.cs | 378 ++ .../Generated/UsageOperations.cs | 423 ++ .../Generated/UsageOperationsExtensions.cs | 101 + ...VirtualMachineExtensionImagesOperations.cs | 670 ++ ...hineExtensionImagesOperationsExtensions.cs | 160 + .../VirtualMachineExtensionsOperations.cs | 1188 ++++ ...alMachineExtensionsOperationsExtensions.cs | 421 ++ .../VirtualMachineImagesEdgeZoneOperations.cs | 1143 ++++ ...chineImagesEdgeZoneOperationsExtensions.cs | 315 + .../VirtualMachineImagesOperations.cs | 1290 ++++ ...irtualMachineImagesOperationsExtensions.cs | 321 + .../VirtualMachineRunCommandsOperations.cs | 1927 ++++++ ...lMachineRunCommandsOperationsExtensions.cs | 563 ++ ...tualMachineScaleSetExtensionsOperations.cs | 1371 ++++ ...eScaleSetExtensionsOperationsExtensions.cs | 449 ++ ...achineScaleSetRollingUpgradesOperations.cs | 841 +++ ...eSetRollingUpgradesOperationsExtensions.cs | 303 + ...alMachineScaleSetVMExtensionsOperations.cs | 1241 ++++ ...caleSetVMExtensionsOperationsExtensions.cs | 467 ++ ...lMachineScaleSetVMRunCommandsOperations.cs | 1415 ++++ ...aleSetVMRunCommandsOperationsExtensions.cs | 503 ++ .../VirtualMachineScaleSetVMsOperations.cs | 3695 ++++++++++ ...lMachineScaleSetVMsOperationsExtensions.cs | 1387 ++++ .../VirtualMachineScaleSetsOperations.cs | 6031 +++++++++++++++++ ...ualMachineScaleSetsOperationsExtensions.cs | 2054 ++++++ .../VirtualMachineSizesOperations.cs | 247 + ...VirtualMachineSizesOperationsExtensions.cs | 63 + .../Generated/VirtualMachinesOperations.cs | 5777 ++++++++++++++++ .../VirtualMachinesOperationsExtensions.cs | 1953 ++++++ .../Properties/AssemblyInfo.cs | 30 + src/Compute/Compute.Management.Sdk/README.md | 84 + src/Compute/Compute.sln | 12 +- src/Compute/Compute/Az.Compute.psd1 | 3 +- src/Compute/Compute/Compute.csproj | 2 +- 727 files changed, 160919 insertions(+), 6 deletions(-) create mode 100644 src/Compute/Compute.Management.Sdk/Compute.Management.Sdk.csproj create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/CapacityReservation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUtilization.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/CloudServiceNetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroupUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/Disk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetParameters .cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DiskRestorePoint.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/DiskUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionPublishingProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IResourceSkusOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IRestorePointsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetVMsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachinesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/ImageDiskReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/NetworkInterfaceReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/ResourceSkusOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/RestorePointsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/Snapshot.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/SnapshotUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/SubResourceWithColocationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/SupportedCapabilities.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachine.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineCaptureResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineNetworkInterfaceConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommand.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommandUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSet.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetExtensionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetIPConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetNetworkConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetReimageParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateIPConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateNetworkConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVM.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtension.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtensionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ComputeManagementClient.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DisksOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/DisksOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleriesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IAvailabilitySetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICloudServiceOperatingSystemsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRoleInstancesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRolesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICloudServicesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICloudServicesUpdateDomainOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IComputeManagementClient.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDiskAccessesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDiskEncryptionSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDiskRestorePointOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IDisksOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IGallerySharingProfileOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ILogAnalyticsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IProximityPlacementGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IResourceSkusOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IRestorePointCollectionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IRestorePointsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ISharedGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ISnapshotsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ISshPublicKeysOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IUsageOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesEdgeZoneOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineRunCommandsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMRunCommandsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineSizesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/IVirtualMachinesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AccessLevel.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AccessUri.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalCapabilities.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalUnattendContent.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AggregatedReplicationState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeOption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ApiEntityReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ApiError.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ApiErrorBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ApplicationProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Architecture.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ArchitectureTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradePolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradeProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticRepairsPolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySet.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetSkuTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/AvailablePatchSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/BillingProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnostics.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnosticsInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CachingTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceViewTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewWithName.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUtilization.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudService.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceNetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceOsProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRole.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfileProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceSlotType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpgradeMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultAndSecretReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultCertificate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultSecretGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGallery.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageIdentifier.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ComponentNames.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ComputeOperationValue.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ConfidentialVMEncryptionType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ConsistencyModeTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CopyCompletionError.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/CreationData.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DataAccessAuthMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DataDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImageEncryption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHost.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAllocatableVM.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAvailableCapacity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceViewWithName.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostLicenseTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DeleteOptions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiagnosticsProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskOptions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskPlacement.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Disallowed.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DisallowedConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Disk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccess.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccessUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskControllerTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOptionTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskDeleteOptionTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskDetachOptionTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSet.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetIdentityType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskImageEncryption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePoint.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointAttributes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointReplicationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskStorageAccountTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DiskUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/DomainNameLabelScopeTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EdgeZoneStorageAccountType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Encryption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionImages.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSetIdentity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsCollection.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsElement.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExecutionState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypeForListVMs.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetCapacityReservationGroups.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetVMScaleSets.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForListVMs.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Extension.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/FileFormat.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Gallery.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplication.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomAction.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameter.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameterType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionPublishingProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionSafetyProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactPublishingProfileBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSafetyProfileBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionFullSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDataDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImageSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExpandParams.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocationType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryIdentifier.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageFeature.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageIdentifier.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionPublishingProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionSafetyProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryOSDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryProvisioningState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GallerySharingPermissionTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryTargetExtendedLocation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GalleryUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/GrantAccessData.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/HardwareProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/HostCaching.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGeneration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/IPVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/IPVersions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Image.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageDataDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageDeprecationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageDiskReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageOSDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImagePurchasePlan.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ImageUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/InnerError.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/InstanceSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatusesSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/IntervalInMins.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/KeyForDiskEncryptionSet.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndKeyReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndSecretReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultKeyReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultSecretReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LastPatchInstallationSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LatestGalleryImageVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchAssessmentMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfigurationProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfigurationProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsInputBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOperationResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOutput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceOperationResultCodeTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceRedeployStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ManagedArtifact.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ManagedDiskParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkAccessPolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkApiVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliaryMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliarySku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/NetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageEncryption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageSecurityProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSFamily.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSFamilyProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSImageNotificationProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSProfileProvisioningData.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionPropertiesBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemStateTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceNames.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateAction.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateInput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Page1.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PassNames.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PatchAssessmentState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationDetail.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PatchOperationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PatchSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PirCommunityGalleryResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PirResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PirSharedGalleryResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Plan.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolationCategory.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PriorityMixPolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpoint.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointServiceConnectionStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResourceListResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PropertyUpdatesInProgress.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProtocolTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProxyOnlyResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ProxyResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuName.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuTier.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAllocationMethod.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PublicNetworkAccess.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/PurchasePlan.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RecommendedMachineConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RecoveryWalkResponse.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RegionalReplicationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RegionalSharingStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RepairAction.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatusTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RequestRateByIntervalInput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Resource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceIdentityType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceInstanceViewStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceRange.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapabilities.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacityScaleType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCosts.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuLocationInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsReasonCode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuZoneDetails.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ResourceWithOptionalLocation.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePoint.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollection.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionExpandOptions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionSourceProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryption.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryptionType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointExpandOptions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceMetadata.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMDataDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMOSDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RetrieveBootDiagnosticsDataResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstance.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceNetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstances.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollbackStatusInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeActionType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradePolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeProgressInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeRunningStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusCode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocument.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocumentBase.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInputParameter.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandManagedIdentity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandParameterDefinition.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ScaleInPolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ScheduledEventsProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SecurityEncryptionTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SecurityPostureReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SecurityProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SecurityTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SelectPermissions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ServiceArtifactReference.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SettingNames.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ShareInfoElement.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGallery.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDataDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryHostCaching.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersionStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryOSDiskImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharedToValues.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroupTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdateOperationTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Sku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Snapshot.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotStorageAccountTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SoftDeletePolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SourceVault.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SpotRestorePolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SshConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKey.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyUpdateResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/StatusCodeCount.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/StatusLevelTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/StorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SubResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceReadOnly.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceWithColocationStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SupportedCapabilities.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/SystemData.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/TargetRegion.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/TerminateNotificationProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/ThrottledRequestsInput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UefiSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpdateDomain.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResourceDefinition.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoryStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationInvoker.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradePolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeState.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/Usage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UsageName.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactManage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/UserAssignedIdentitiesValue.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMDiskSecurityProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGalleryApplication.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationLinux.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationWindows.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootBehavior.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootSetting.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VMSizeProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VaultCertificate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VaultSecretGroup.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualHardDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachine.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAgentInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAssessPatchesResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineEvictionPolicyTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtension.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionsListResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineHealthStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIdentity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImage.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageFeature.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageResource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIpTag.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePatchStatus.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePriorityTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineReimageParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommand.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandScriptSource.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSet.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetDataDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtension.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIdentity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIpTag.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetReimageParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetScaleInRules.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSku.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVM.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtension.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProfile.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetsReapplyHeaders.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSize.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSizeTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSoftwarePatchProperties.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineStatusCodeCount.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineUpdate.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VmDiskTypes.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/VmImagesInEdgeZoneListResult.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WinRMConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WinRMListener.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsConfiguration.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsParameters.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsPatchAssessmentMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformSettings.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchMode.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/Operations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/OperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SdkInfo_ComputeManagementClient.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/UsageOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/UsageOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperations.cs create mode 100644 src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs create mode 100644 src/Compute/Compute.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/Compute/Compute.Management.Sdk/README.md diff --git a/src/Compute/Compute.Management.Sdk/Compute.Management.Sdk.csproj b/src/Compute/Compute.Management.Sdk/Compute.Management.Sdk.csproj new file mode 100644 index 000000000000..e474b44c7ea7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Compute.Management.Sdk.csproj @@ -0,0 +1,18 @@ + + + + Compute + + + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Compute.Management.Sdk + Microsoft.Azure.Management.Compute + $(NoWarn);CS0108;CS1573 + + + + + diff --git a/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservation.cs b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservation.cs new file mode 100644 index 000000000000..5c3157aa35fc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservation.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class CapacityReservation : Resource + { + public CapacityReservation(string location, Sku sku, string id, string name, string type, IDictionary tags, string reservationId, IList virtualMachinesAssociated, System.DateTime? provisioningTime, string provisioningState, CapacityReservationInstanceView instanceView, IList zones) + : base(location, id, name, type, tags) + { + ReservationId = reservationId; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + Sku = sku; + Zones = zones; + CustomInit(); + } + + public CapacityReservation(string location, Sku sku, string id, string name, string type, IDictionary tags, string reservationId, IList virtualMachinesAssociated, System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), CapacityReservationInstanceView instanceView = default(CapacityReservationInstanceView), System.DateTime? timeCreated = default(System.DateTime?), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + ReservationId = reservationId; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + Zones = zones; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUpdate.cs new file mode 100644 index 000000000000..537c5256d921 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUpdate.cs @@ -0,0 +1,37 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CapacityReservationUpdate : UpdateResource + { + public CapacityReservationUpdate(IDictionary tags, string reservationId, IList virtualMachinesAssociated, System.DateTime? provisioningTime, string provisioningState, CapacityReservationInstanceView instanceView, Sku sku) + : base(tags) + { + ReservationId = reservationId; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + Sku = sku; + CustomInit(); + } + + public CapacityReservationUpdate(IDictionary tags, string reservationId, IList virtualMachinesAssociated = default(IList), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), CapacityReservationInstanceView instanceView = default(CapacityReservationInstanceView), System.DateTime? timeCreated = default(System.DateTime?), Sku sku = default(Sku)) + : base(tags) + { + ReservationId = reservationId; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUtilization.cs b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUtilization.cs new file mode 100644 index 000000000000..636aa11761a5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/CapacityReservationUtilization.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CapacityReservationUtilization + { + public CapacityReservationUtilization(IList virtualMachinesAllocated) + { + VirtualMachinesAllocated = virtualMachinesAllocated; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/CloudServiceNetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Customizations/CloudServiceNetworkProfile.cs new file mode 100644 index 000000000000..0b6fc660318f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/CloudServiceNetworkProfile.cs @@ -0,0 +1,17 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CloudServiceNetworkProfile + { + public CloudServiceNetworkProfile(IList loadBalancerConfigurations, SubResource swappableCloudService) + { + LoadBalancerConfigurations = loadBalancerConfigurations; + SwappableCloudService = swappableCloudService; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroup.cs b/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroup.cs new file mode 100644 index 000000000000..a19bbf9fe57e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroup.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class DedicatedHostGroup : Resource + { + public DedicatedHostGroup(string location, int platformFaultDomainCount, string id, string name, string type, IDictionary tags, IList hosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement, IList zones) + : base(location, id, name, type, tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + Zones = zones; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroupUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroupUpdate.cs new file mode 100644 index 000000000000..4ed30060ea1c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DedicatedHostGroupUpdate.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class DedicatedHostGroupUpdate : UpdateResource + { + public DedicatedHostGroupUpdate(int platformFaultDomainCount, IDictionary tags, IList hosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement, IList zones) + : base(tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + Zones = zones; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/Disk.cs b/src/Compute/Compute.Management.Sdk/Customizations/Disk.cs new file mode 100644 index 000000000000..32f2c7c7a5c8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/Disk.cs @@ -0,0 +1,177 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections.Generic; + + /// + /// Disk resource. + /// + public partial class Disk : Resource + { + /// + /// Initializes a new instance of the Disk class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A relative URI containing the ID of the VM + /// that has the disk attached. + /// List of relative URIs containing + /// the IDs of the VMs that have the disk attached. maxShares should be + /// set to a value greater than one for disks to allow attaching them + /// to multiple VMs. + /// The Logical zone list for Disk. + /// The extended location where the disk + /// will be created. Extended location cannot be changed. + /// The time when the disk was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the the + /// image from which the OS disk was created. E.g. - {name: + /// 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + /// WindowsServer} + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used for Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The state of the disk. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen', + /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload', + /// 'ActiveUpload' + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Details of the list of all VMs that have + /// the disk attached. maxShares should be set to a value greater than + /// one for disks to allow attaching them to multiple VMs. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// Set to true to enable bursting beyond + /// the provisioned performance target of the disk. Bursting is + /// disabled by default. Does not apply to Ultra disks. + /// Properties of the disk for + /// which update is pending. + /// Indicates the OS on a disk + /// supports hibernation. + /// Contains the security related + /// information for the resource. + public Disk(string location, CreationData creationData, string id, string name, string type, IDictionary tags, string managedBy, IList managedByExtended, DiskSku sku, IList zones, ExtendedLocation extendedLocation, System.DateTime? timeCreated, OperatingSystemTypes? osType, string hyperVGeneration, PurchasePlan purchasePlan, int? diskSizeGB, long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), long? diskIOPSReadOnly = default(long?), long? diskMBpsReadOnly = default(long?), string diskState = default(string), Encryption encryption = default(Encryption), int? maxShares = default(int?), IList shareInfo = default(IList), string networkAccessPolicy = default(string), string diskAccessId = default(string), string tier = default(string), bool? burstingEnabled = default(bool?), PropertyUpdatesInProgress propertyUpdatesInProgress = default(PropertyUpdatesInProgress), bool? supportsHibernation = default(bool?), DiskSecurityProfile securityProfile = default(DiskSecurityProfile)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + ManagedByExtended = managedByExtended; + Sku = sku; + Zones = zones; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + DiskState = diskState; + Encryption = encryption; + MaxShares = maxShares; + ShareInfo = shareInfo; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + SecurityProfile = securityProfile; + CustomInit(); + } + + public Disk(string location, CreationData creationData, string id, string name, string type, IDictionary tags, string managedBy, IList managedByExtended, DiskSku sku, IList zones, ExtendedLocation extendedLocation, System.DateTime? timeCreated, OperatingSystemTypes? osType, string hyperVGeneration, PurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, int? diskSizeGB, long? diskSizeBytes, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, string diskState, Encryption encryption, int? maxShares, IList shareInfo, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled = default(bool?), PropertyUpdatesInProgress propertyUpdatesInProgress = default(PropertyUpdatesInProgress), bool? supportsHibernation = default(bool?), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), double? completionPercent = default(double?), string publicNetworkAccess = default(string), string dataAccessAuthMode = default(string), bool? optimizedForFrequentAttach = default(bool?)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + ManagedByExtended = managedByExtended; + Sku = sku; + Zones = zones; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + DiskState = diskState; + Encryption = encryption; + MaxShares = maxShares; + ShareInfo = shareInfo; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + SecurityProfile = securityProfile; + CompletionPercent = completionPercent; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + OptimizedForFrequentAttach = optimizedForFrequentAttach; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetParameters .cs b/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetParameters .cs new file mode 100644 index 000000000000..18156d1e15b1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetParameters .cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + + public partial class DiskEncryptionSetParameters : SubResource + { + public DiskEncryptionSetParameters(string id = default(string)) + : base(id) + { + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetUpdate.cs new file mode 100644 index 000000000000..682194cd1f43 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DiskEncryptionSetUpdate.cs @@ -0,0 +1,48 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set update resource. + /// + public partial class DiskEncryptionSetUpdate + { + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + /// Possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// Active Key of the encryption + public DiskEncryptionSetUpdate(string encryptionType, KeyForDiskEncryptionSet activeKey) + { + EncryptionType = encryptionType; + ActiveKey = activeKey; + CustomInit(); + } + + public DiskEncryptionSetUpdate(string encryptionType, KeyForDiskEncryptionSet activeKey, IDictionary tags) + { + EncryptionType = encryptionType; + ActiveKey = activeKey; + Tags = tags; + CustomInit(); + } + + public DiskEncryptionSetUpdate(string encryptionType = default(string), KeyForDiskEncryptionSet activeKey = default(KeyForDiskEncryptionSet), bool? rotationToLatestKeyVersionEnabled = default(bool?), IDictionary tags = default(IDictionary), EncryptionSetIdentity identity = default(EncryptionSetIdentity)) + { + EncryptionType = encryptionType; + ActiveKey = activeKey; + RotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + Tags = tags; + Identity = identity; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DiskRestorePoint.cs b/src/Compute/Compute.Management.Sdk/Customizations/DiskRestorePoint.cs new file mode 100644 index 000000000000..fe4fea2386cc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DiskRestorePoint.cs @@ -0,0 +1,49 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + /// + /// Properties of disk restore point + /// + public partial class DiskRestorePoint : ProxyOnlyResource + { + /// + /// Initializes a new instance of the DiskRestorePoint class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// The timestamp of restorePoint + /// creation + /// arm id of source disk + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the the + /// image from which the OS disk was created. + /// id of the backing snapshot's MIS + /// family + /// unique incarnation id of the source + /// disk + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Indicates the OS on a disk + /// supports hibernation. + public DiskRestorePoint(string id, string name, string type, System.DateTime? timeCreated, string sourceResourceId, OperatingSystemTypes? osType, string hyperVGeneration, PurchasePlan purchasePlan, string familyId, string sourceUniqueId = default(string), Encryption encryption = default(Encryption), bool? supportsHibernation = default(bool?)) + : base(id, name, type) + { + TimeCreated = timeCreated; + SourceResourceId = sourceResourceId; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + FamilyId = familyId; + SourceUniqueId = sourceUniqueId; + Encryption = encryption; + SupportsHibernation = supportsHibernation; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/DiskUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/DiskUpdate.cs new file mode 100644 index 000000000000..1a074c4e4708 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/DiskUpdate.cs @@ -0,0 +1,190 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections.Generic; + + /// + /// Disk update resource. + /// + public partial class DiskUpdate + { + /// + /// Initializes a new instance of the DiskUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// Set to true to enable bursting beyond + /// the provisioned performance target of the disk. Bursting is + /// disabled by default. Does not apply to Ultra disks. + /// Purchase plan information to be added on + public DiskUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, int? maxShares, Encryption encryption, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled, PurchasePlan purchasePlan) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + CustomInit(); + } + + public DiskUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, int? maxShares, Encryption encryption, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled, PurchasePlan purchasePlan, IDictionary tags) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + Tags = tags; + CustomInit(); + } + + public DiskUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, int? maxShares, Encryption encryption, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled, PurchasePlan purchasePlan, IDictionary tags, DiskSku sku) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + Tags = tags; + Sku = sku; + CustomInit(); + } + + public DiskUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, int? maxShares, Encryption encryption, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled, PurchasePlan purchasePlan, PropertyUpdatesInProgress propertyUpdatesInProgress, bool? supportsHibernation = default(bool?), IDictionary tags = default(IDictionary), DiskSku sku = default(DiskSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + Tags = tags; + Sku = sku; + CustomInit(); + } + + public DiskUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection,long? diskIOPSReadWrite, long? diskMBpsReadWrite, long? diskIOPSReadOnly, long? diskMBpsReadOnly, int? maxShares, Encryption encryption, string networkAccessPolicy, string diskAccessId, string tier, bool? burstingEnabled, PurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, PropertyUpdatesInProgress propertyUpdatesInProgress, bool? supportsHibernation, string publicNetworkAccess, IDictionary tags, DiskSku sku = default(DiskSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + Tags = tags; + Sku = sku; + CustomInit(); + } + + public DiskUpdate(OperatingSystemTypes? osType , int? diskSizeGB , EncryptionSettingsCollection encryptionSettingsCollection , long? diskIOPSReadWrite , long? diskMBpsReadWrite , long? diskIOPSReadOnly , long? diskMBpsReadOnly , int? maxShares , Encryption encryption , string networkAccessPolicy , string diskAccessId , string tier , bool? burstingEnabled , PurchasePlan purchasePlan , SupportedCapabilities supportedCapabilities , PropertyUpdatesInProgress propertyUpdatesInProgress , bool? supportsHibernation , string publicNetworkAccess , string dataAccessAuthMode , IDictionary tags , DiskSku sku = default(DiskSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + Tags = tags; + Sku = sku; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperations.cs new file mode 100644 index 000000000000..1070db2134c9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperations.cs @@ -0,0 +1,284 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleriesOperations operations. + /// + internal partial class GalleriesOperations : IServiceOperations, IGalleriesOperations + { + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + string apiVersion = "2021-10-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("select", select); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName) + { + return await GetWithHttpMessagesAsync(resourceGroupName, galleryName, default(string), null, default(CancellationToken)); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders) + { + return await GetWithHttpMessagesAsync(resourceGroupName, galleryName, default(string), customHeaders, default(CancellationToken)); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await GetWithHttpMessagesAsync(resourceGroupName, galleryName, default(string), customHeaders, cancellationToken); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperationsExtensions.cs new file mode 100644 index 000000000000..d95e5985f89c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleriesOperationsExtensions.cs @@ -0,0 +1,58 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleriesOperations. + /// + public static partial class GalleriesOperationsExtensions + { + public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select, CancellationToken cancellationToken) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, select, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + { + return await GetAsync(operations, resourceGroupName, galleryName, default(string), default(CancellationToken)); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken) + { + return await GetAsync(operations, resourceGroupName, galleryName, default(string), cancellationToken); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersion.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersion.cs new file mode 100644 index 000000000000..d95153dffdb2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersion.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class GalleryApplicationVersion + { + public GalleryApplicationVersion( + string location, + GalleryApplicationVersionPublishingProfile publishingProfile, + string id, + string name, + string type, + IDictionary tags, + string provisioningState, + ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(location, id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionPublishingProfile.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionPublishingProfile.cs new file mode 100644 index 000000000000..825032e43e09 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionPublishingProfile.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The publishing profile of a gallery image version. + /// + public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase + { + public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList targetRegions, int? replicaCount, bool? excludeFromLatest, System.DateTime? publishedDate, System.DateTime? endOfLifeDate, string storageAccountType, string replicationMode, UserArtifactManage manageActions, bool? enableHealthCheck = default(bool?)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType, replicationMode) + { + Source = source; + ManageActions = manageActions; + EnableHealthCheck = enableHealthCheck; + CustomInit(); + } + + public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList targetRegions, int? replicaCount, bool? excludeFromLatest, System.DateTime? publishedDate, System.DateTime? endOfLifeDate, string storageAccountType, string replicationMode, IList targetExtendedLocations, UserArtifactManage manageActions, bool? enableHealthCheck = default(bool?)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType, replicationMode, targetExtendedLocations) + { + Source = source; + ManageActions = manageActions; + EnableHealthCheck = enableHealthCheck; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionUpdate.cs new file mode 100644 index 000000000000..c1aea2411a2e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleryApplicationVersionUpdate.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class GalleryApplicationVersionUpdate + { + GalleryApplicationVersionUpdate( + GalleryApplicationVersionPublishingProfile publishingProfile, + string id, + string name, + string type, + IDictionary tags, + string provisioningState, + ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersion.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersion.cs new file mode 100644 index 000000000000..942304685c12 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersion.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class GalleryImageVersion + { + public GalleryImageVersion( + string location, + GalleryImageVersionStorageProfile storageProfile, + string id, + string name, + string type, + IDictionary tags, + GalleryImageVersionPublishingProfile publishingProfile, + string provisioningState, + ReplicationStatus replicationStatus) + : base(location, id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersionUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersionUpdate.cs new file mode 100644 index 000000000000..d658af6c2bf3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/GalleryImageVersionUpdate.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class GalleryImageVersionUpdate + { + public GalleryImageVersionUpdate( + GalleryImageVersionStorageProfile storageProfile, + string id, + string name, + string type, + IDictionary tags, + GalleryImageVersionPublishingProfile publishingProfile, + string provisioningState, + ReplicationStatus replicationStatus) + : base(id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IGalleriesOperations.cs new file mode 100644 index 000000000000..2bdc16482412 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IGalleriesOperations.cs @@ -0,0 +1,87 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleriesOperations operations. + /// + public partial interface IGalleriesOperations + { + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName); + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders); + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders, CancellationToken cancellationToken); + + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IResourceSkusOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IResourceSkusOperations.cs new file mode 100644 index 000000000000..d2a9799bfaf1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IResourceSkusOperations.cs @@ -0,0 +1,20 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ResourceSkusOperations operations. + /// + public partial interface IResourceSkusOperations + { + Task>> ListWithHttpMessagesAsync(string filter, Dictionary> customHeaders, CancellationToken cancellationToken); + + Task>> ListWithHttpMessagesAsync(string filter, Dictionary> customHeaders); + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IRestorePointsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IRestorePointsOperations.cs new file mode 100644 index 000000000000..4cc47594a066 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IRestorePointsOperations.cs @@ -0,0 +1,15 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + public partial interface IRestorePointsOperations + { + Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)); + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetVMsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 000000000000..89b511623be1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,30 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMsOperations + { + + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders, CancellationToken cancellationToken); + + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders); + + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders, CancellationToken cancellationToken); + + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders); + + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetsOperations.cs new file mode 100644 index 000000000000..044be1bffbfc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachineScaleSetsOperations.cs @@ -0,0 +1,90 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + public partial interface IVirtualMachineScaleSetsOperations + { + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + Task> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, Dictionary> customHeaders, CancellationToken cancellationToken); + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders, CancellationToken cancellationToken); + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders); + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName); + } + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachinesOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachinesOperations.cs new file mode 100644 index 000000000000..dd8654219301 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/IVirtualMachinesOperations.cs @@ -0,0 +1,108 @@ +namespace Microsoft.Azure.Management.Compute +{ + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Rest.Azure; + using Microsoft.Azure.Management.Compute.Models; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAllWithHttpMessagesAsync(string statusOnly, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken); + + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken); + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders); + + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken); + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders); + + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? tempDisk = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/ImageDiskReference.cs b/src/Compute/Compute.Management.Sdk/Customizations/ImageDiskReference.cs new file mode 100644 index 000000000000..98d067f02a3c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/ImageDiskReference.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image used for creating the disk. + /// + public partial class ImageDiskReference + { + + /// + /// Initializes a new instance of the ImageDiskReference class. + /// + /// A relative uri containing either a Platform Image + /// Repository, user image, or Azure Compute Gallery image + /// reference. + /// If the disk is created from an image's data disk, + /// this is an index that indicates which of the data disks in the + /// image to use. For OS disks, this field is null. + public ImageDiskReference(string id = default(string), int? lun = default(int?)) + { + Id = id; + Lun = lun; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/NetworkInterfaceReference.cs b/src/Compute/Compute.Management.Sdk/Customizations/NetworkInterfaceReference.cs new file mode 100644 index 000000000000..62dfec700d43 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/NetworkInterfaceReference.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class NetworkInterfaceReference : SubResource + { + public NetworkInterfaceReference(string id = default(string), bool? primary = default(bool?), string deleteOption = default(string)) + : base(id) + { + Primary = primary; + DeleteOption = deleteOption; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/ResourceSkusOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/ResourceSkusOperations.cs new file mode 100644 index 000000000000..325e0dee0860 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/ResourceSkusOperations.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ResourceSkusOperations operations. + /// + internal partial class ResourceSkusOperations : IServiceOperations, IResourceSkusOperations + { + public async Task>> ListWithHttpMessagesAsync(string filter, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await ListWithHttpMessagesAsync(filter, null, customHeaders, cancellationToken); + } + public async Task>> ListWithHttpMessagesAsync(string filter, Dictionary> customHeaders) + { + return await ListWithHttpMessagesAsync(filter, null, customHeaders, default(CancellationToken)); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/RestorePointsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/RestorePointsOperations.cs new file mode 100644 index 000000000000..fc71b5faa07e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/RestorePointsOperations.cs @@ -0,0 +1,187 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + internal partial class RestorePointsOperations : IServiceOperations, IRestorePointsOperations + { + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (restorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointName"); + } + string apiVersion = "2021-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("restorePointName", restorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/Snapshot.cs b/src/Compute/Compute.Management.Sdk/Customizations/Snapshot.cs new file mode 100644 index 000000000000..0b05bd58e89e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/Snapshot.cs @@ -0,0 +1,152 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections.Generic; + + /// + /// Snapshot resource. + /// + public partial class Snapshot : Resource + { + /// + /// Initializes a new instance of the Snapshot class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Unused. Always Null. + /// The extended location where the + /// snapshot will be created. Extended location cannot be + /// changed. + /// The time when the snapshot was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the image + /// from which the source disk for the snapshot was originally + /// created. + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// The state of the snapshot. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen', + /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload', + /// 'ActiveUpload' + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// Whether a snapshot is incremental. + /// Incremental snapshots on the same disk occupy less space than full + /// snapshots and can be diffed. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Indicates the OS on a snapshot + /// supports hibernation. + public Snapshot(string location, CreationData creationData, string id, string name, string type, IDictionary tags, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, System.DateTime? timeCreated, OperatingSystemTypes? osType, string hyperVGeneration, PurchasePlan purchasePlan, int? diskSizeGB, long? diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), bool? supportsHibernation = default(bool?)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + Sku = sku; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + DiskState = diskState; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + Incremental = incremental; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SupportsHibernation = supportsHibernation; + CustomInit(); + } + + public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), ExtendedLocation extendedLocation = default(ExtendedLocation), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), bool? supportsHibernation = default(bool?), string publicNetworkAccess = default(string), double? completionPercent = default(double?), string dataAccessAuthMode = default(string)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + Sku = sku; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + DiskState = diskState; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + Incremental = incremental; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SecurityProfile = securityProfile; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + CompletionPercent = completionPercent; + DataAccessAuthMode = dataAccessAuthMode; + CustomInit(); + } + + public Snapshot(string location, CreationData creationData, string id , string name , string type , IDictionary tags , string managedBy , SnapshotSku sku , ExtendedLocation extendedLocation , System.DateTime? timeCreated , OperatingSystemTypes? osType , string hyperVGeneration , PurchasePlan purchasePlan , SupportedCapabilities supportedCapabilities , int? diskSizeGB , long? diskSizeBytes , string diskState , string uniqueId , EncryptionSettingsCollection encryptionSettingsCollection , string provisioningState , bool? incremental , Encryption encryption , string networkAccessPolicy = default(string), string diskAccessId = default(string), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), bool? supportsHibernation = default(bool?), string publicNetworkAccess = default(string), double? completionPercent = default(double?), CopyCompletionError copyCompletionError = default(CopyCompletionError), string dataAccessAuthMode = default(string)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + Sku = sku; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + DiskState = diskState; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + Incremental = incremental; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SecurityProfile = securityProfile; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + CompletionPercent = completionPercent; + CopyCompletionError = copyCompletionError; + DataAccessAuthMode = dataAccessAuthMode; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/SnapshotUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/SnapshotUpdate.cs new file mode 100644 index 000000000000..0156e32adf9d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/SnapshotUpdate.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Snapshot update resource. + /// + public partial class SnapshotUpdate + { + /// + /// Initializes a new instance of the SnapshotUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + public SnapshotUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + CustomInit(); + } + + public SnapshotUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, IDictionary tags) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tags = tags; + CustomInit(); + } + + public SnapshotUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, IDictionary tags, SnapshotSku sku) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tags = tags; + Sku = sku; + CustomInit(); + } + + public SnapshotUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, bool? supportsHibernation, IDictionary tags, SnapshotSku sku = default(SnapshotSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SupportsHibernation = supportsHibernation; + Tags = tags; + Sku = sku; + CustomInit(); + } + + public SnapshotUpdate(OperatingSystemTypes? osType, int? diskSizeGB, EncryptionSettingsCollection encryptionSettingsCollection, Encryption encryption, string networkAccessPolicy, string diskAccessId, bool? supportsHibernation, string publicNetworkAccess, SupportedCapabilities supportedCapabilities, IDictionary tags = default(IDictionary), SnapshotSku sku = default(SnapshotSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + SupportedCapabilities = supportedCapabilities; + Tags = tags; + Sku = sku; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/SubResourceWithColocationStatus.cs b/src/Compute/Compute.Management.Sdk/Customizations/SubResourceWithColocationStatus.cs new file mode 100644 index 000000000000..7ca3a377c0d6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/SubResourceWithColocationStatus.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Rest.Azure; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class SubResourceWithColocationStatus : SubResource + { + public SubResourceWithColocationStatus(string id = default(string), InstanceViewStatus colocationStatus = default(InstanceViewStatus)) + : base(id) + { + ColocationStatus = colocationStatus; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/SupportedCapabilities.cs b/src/Compute/Compute.Management.Sdk/Customizations/SupportedCapabilities.cs new file mode 100644 index 000000000000..2e7de41dd5a1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/SupportedCapabilities.cs @@ -0,0 +1,21 @@ + + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections.Generic; + + /// + /// Disk update resource. + /// + public partial class SupportedCapabilities + { + + public SupportedCapabilities(bool? acceleratedNetwork , string architecture = default(string)) + { + AcceleratedNetwork = acceleratedNetwork; + Architecture = architecture; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachine.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachine.cs new file mode 100644 index 000000000000..03d7f639114f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachine.cs @@ -0,0 +1,581 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine. + /// + public partial class VirtualMachine : Resource + { + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, IList resources, VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, IList resources, VirtualMachineIdentity identity, IList zones, ExtendedLocation extendedLocation) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, IList resources, VirtualMachineIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Resources = resources; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, IList resources, VirtualMachineIdentity identity) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Resources = resources; + Identity = identity; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, IList resources) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Resources = resources; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, IList resources, VirtualMachineIdentity identity, IList zones, ExtendedLocation extendedLocation) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, IList resources, VirtualMachineIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + Resources = resources; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, IList resources, VirtualMachineIdentity identity) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + Resources = resources; + Identity = identity; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, IList resources) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Resources = resources; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, IList resources, VirtualMachineIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Resources = resources; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, IList resources, VirtualMachineIdentity identity) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Resources = resources; + Identity = identity; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, IList resources, VirtualMachineIdentity identity, IList zones, ExtendedLocation extendedLocation) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, IList resources, VirtualMachineIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + Resources = resources; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, IList resources, VirtualMachineIdentity identity) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + Resources = resources; + Identity = identity; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, IList resources) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + Resources = resources; + CustomInit(); + } + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + CustomInit(); + } + + public VirtualMachine(string location, string id, string name, string type, IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineCaptureResult.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineCaptureResult.cs new file mode 100644 index 000000000000..76c1e7cd2926 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineCaptureResult.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineCaptureResult : SubResource + { + public VirtualMachineCaptureResult(string id = default(string), string schema = default(string), string contentVersion = default(string), object parameters = default(object), IList resources = default(IList)) + : base(id) + { + Schema = schema; + ContentVersion = contentVersion; + Parameters = parameters; + Resources = resources; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineImage.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineImage.cs new file mode 100644 index 000000000000..dedc6ecd603f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineImage.cs @@ -0,0 +1,88 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Image. + /// + public partial class VirtualMachineImage : VirtualMachineImageResource + { + + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + /// The name of the resource. + /// The supported Azure location of the + /// resource. + /// Resource Id + /// 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). + /// Possible values include: 'V1', + /// 'V2' + /// Specifies disallowed configuration for the + /// VirtualMachine created from the image + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties, string hyperVGeneration, DisallowedConfiguration disallowed) + : base(name, location, id, tags) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; + HyperVGeneration = hyperVGeneration; + Disallowed = disallowed; + CustomInit(); + } + + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties, string hyperVGeneration) + : base(name, location, id, tags) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; + HyperVGeneration = hyperVGeneration; + CustomInit(); + } + + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties) + : base(name, location, id, tags) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; + CustomInit(); + } + + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages) + : base(name, location, id, tags) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan, OSDiskImage osDiskImage) + : base(name, location, id, tags) + { + Plan = plan; + OsDiskImage = osDiskImage; + CustomInit(); + } + + public VirtualMachineImage(string name, string location, string id, IDictionary tags, PurchasePlan plan) + : base(name, location, id, tags) + { + Plan = plan; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineNetworkInterfaceConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineNetworkInterfaceConfiguration.cs new file mode 100644 index 000000000000..5485ed30aeb9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineNetworkInterfaceConfiguration.cs @@ -0,0 +1,37 @@ +// < auto - generated > +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class VirtualMachineNetworkInterfaceConfiguration + { + public VirtualMachineNetworkInterfaceConfiguration(string name, IList ipConfigurations, bool? primary, string deleteOption, bool? enableAcceleratedNetworking, bool? enableFpga, bool? enableIPForwarding = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings = default(VirtualMachineNetworkInterfaceDnsSettingsConfiguration), SubResource dscpConfiguration = default(SubResource)) + { + Name = name; + Primary = primary; + DeleteOption = deleteOption; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + EnableFpga = enableFpga; + EnableIPForwarding = enableIPForwarding; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + DscpConfiguration = dscpConfiguration; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommand.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommand.cs new file mode 100644 index 000000000000..448cd27f99f3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommand.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineRunCommand : Resource + { + public VirtualMachineRunCommand(string location, string id, string name, string type, IDictionary tags, VirtualMachineRunCommandScriptSource source, IList parameters, IList protectedParameters, bool? asyncExecution, string runAsUser, string runAsPassword, int? timeoutInSeconds, string outputBlobUri, string errorBlobUri,string provisioningState, VirtualMachineRunCommandInstanceView instanceView) + : base(location, id, name, type, tags) + { + Source = source; + Parameters = parameters; + ProtectedParameters = protectedParameters; + AsyncExecution = asyncExecution; + RunAsUser = runAsUser; + RunAsPassword = runAsPassword; + TimeoutInSeconds = timeoutInSeconds; + OutputBlobUri = outputBlobUri; + ErrorBlobUri = errorBlobUri; + ProvisioningState = provisioningState; + InstanceView = instanceView; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommandUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommandUpdate.cs new file mode 100644 index 000000000000..a152283ce744 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineRunCommandUpdate.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineRunCommandUpdate : UpdateResource + { + public VirtualMachineRunCommandUpdate(IDictionary tags, VirtualMachineRunCommandScriptSource source, IList parameters, IList protectedParameters, bool? asyncExecution, string runAsUser, string runAsPassword, int? timeoutInSeconds, string outputBlobUri, string errorBlobUri, string provisioningState, VirtualMachineRunCommandInstanceView instanceView) + : base(tags) + { + Source = source; + Parameters = parameters; + ProtectedParameters = protectedParameters; + AsyncExecution = asyncExecution; + RunAsUser = runAsUser; + RunAsPassword = runAsPassword; + TimeoutInSeconds = timeoutInSeconds; + OutputBlobUri = outputBlobUri; + ErrorBlobUri = errorBlobUri; + ProvisioningState = provisioningState; + InstanceView = instanceView; + CustomInit(); + } + } +} + diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSet.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSet.cs new file mode 100644 index 000000000000..eb862a0d4e41 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSet.cs @@ -0,0 +1,456 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set. + /// + public partial class VirtualMachineScaleSet : Resource + { + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, SpotRestorePolicy spotRestorePolicy, PriorityMixPolicy priorityMixPolicy, System.DateTime? timeCreated, VirtualMachineScaleSetIdentity identity, IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; + SpotRestorePolicy = spotRestorePolicy; + PriorityMixPolicy = priorityMixPolicy; + TimeCreated = timeCreated; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine scale set 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**. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// The provisioning state, which only + /// appears in the response. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// Specifies the ID which uniquely identifies a + /// Virtual Machine Scale Set. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Whether to force strictly even Virtual + /// Machine distribution cross x-zones in case there is zone + /// outage. + /// Fault Domain count for each + /// placement group. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies information about the dedicated + /// host group that the virtual machine scale set resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. + /// The identity of the virtual machine scale + /// set, if configured. + /// The virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale + /// set + /// The extended location of the Virtual + /// Machine Scale Set. + /// + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, SpotRestorePolicy spotRestorePolicy, VirtualMachineScaleSetIdentity identity, IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; + SpotRestorePolicy = spotRestorePolicy; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, VirtualMachineScaleSetIdentity identity, IList zones, ExtendedLocation extendedLocation) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = OrchestrationMode; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, VirtualMachineScaleSetIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = OrchestrationMode; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, VirtualMachineScaleSetIdentity identity) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = OrchestrationMode; + Identity = identity; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = OrchestrationMode; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, VirtualMachineScaleSetIdentity identity, IList zones, ExtendedLocation extendedLocation) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine scale set 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**. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// The provisioning state, which only + /// appears in the response. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// Specifies the ID which uniquely identifies a + /// Virtual Machine Scale Set. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Whether to force strictly even Virtual + /// Machine distribution cross x-zones in case there is zone + /// outage. + /// Fault Domain count for each + /// placement group. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies information about the dedicated + /// host group that the virtual machine scale set resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. + /// The identity of the virtual machine scale + /// set, if configured. + /// The virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale + /// set + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, VirtualMachineScaleSetIdentity identity, IList zones) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + Identity = identity; + Zones = zones; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine scale set 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**. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// The provisioning state, which only + /// appears in the response. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// Specifies the ID which uniquely identifies a + /// Virtual Machine Scale Set. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Whether to force strictly even Virtual + /// Machine distribution cross x-zones in case there is zone + /// outage. + /// Fault Domain count for each + /// placement group. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies information about the dedicated + /// host group that the virtual machine scale set resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. + /// The identity of the virtual machine scale + /// set, if configured. + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, VirtualMachineScaleSetIdentity identity) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + Identity = identity; + CustomInit(); + } + + public VirtualMachineScaleSet(string location, string id, string name, string type, IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, SubResource proximityPlacementGroup, SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, string orchestrationMode, SpotRestorePolicy spotRestorePolicy, System.DateTime? timeCreated, VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; + SpotRestorePolicy = spotRestorePolicy; + TimeCreated = timeCreated; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetExtensionUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetExtensionUpdate.cs new file mode 100644 index 000000000000..e51e800142a9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetExtensionUpdate.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineScaleSetExtensionUpdate : SubResourceReadOnly + { + public VirtualMachineScaleSetExtensionUpdate(string id = default(string), string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), IList provisionAfterExtensions = default(IList), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + ProvisionAfterExtensions = provisionAfterExtensions; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetIPConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetIPConfiguration.cs new file mode 100644 index 000000000000..224a3c602e28 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetIPConfiguration.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineScaleSetIPConfiguration : SubResource + { + public VirtualMachineScaleSetIPConfiguration(string name, string id, ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetPublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + : base(id) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetNetworkConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetNetworkConfiguration.cs new file mode 100644 index 000000000000..3a6ee9882616 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetNetworkConfiguration.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class VirtualMachineScaleSetNetworkConfiguration : SubResource + { + public VirtualMachineScaleSetNetworkConfiguration(string name, IList ipConfigurations, string id, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), bool? enableIPForwarding = default(bool?), string deleteOption = default(string)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + CustomInit(); + } + + public VirtualMachineScaleSetNetworkConfiguration(string name, IList ipConfigurations, string id, bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? disableTcpStateTracking = default(bool?), bool? enableFpga = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), bool? enableIPForwarding = default(bool?), string deleteOption = default(string)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + DisableTcpStateTracking = disableTcpStateTracking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetReimageParameters.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetReimageParameters.cs new file mode 100644 index 000000000000..14b75bbe3024 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetReimageParameters.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set VM Reimage Parameters. + /// + public partial class VirtualMachineScaleSetReimageParameters : VirtualMachineScaleSetVMReimageParameters + { + public VirtualMachineScaleSetReimageParameters(bool? tempDisk,IList instanceIds) + : base(tempDisk) + { + InstanceIds = instanceIds; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdate.cs new file mode 100644 index 000000000000..b25c561aa282 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdate.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineScaleSetUpdate : UpdateResource + { + public VirtualMachineScaleSetUpdate(IDictionary tags, Sku sku, Plan plan, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, bool? singlePlacementGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, SubResource proximityPlacementGroup, VirtualMachineScaleSetIdentity identity) + : base(tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + SinglePlacementGroup = singlePlacementGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + ProximityPlacementGroup = proximityPlacementGroup; + Identity = identity; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateIPConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateIPConfiguration.cs new file mode 100644 index 000000000000..f2744cf05885 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateIPConfiguration.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineScaleSetUpdateIPConfiguration : SubResource + { + public VirtualMachineScaleSetUpdateIPConfiguration(string id = default(string), string name = default(string), ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + : base(id) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateNetworkConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateNetworkConfiguration.cs new file mode 100644 index 000000000000..81087e68fe0e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdateNetworkConfiguration.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : SubResource + { + public VirtualMachineScaleSetUpdateNetworkConfiguration(string id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), IList ipConfigurations = default(IList), bool? enableIPForwarding = default(bool?), string deleteOption = default(string)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + CustomInit(); + } + + public VirtualMachineScaleSetUpdateNetworkConfiguration(string id = default(string), string name = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? disableTcpStateTracking = default(bool?), bool? enableFpga = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), IList ipConfigurations = default(IList), bool? enableIPForwarding = default(bool?), string deleteOption = default(string)) + : base(id) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + DisableTcpStateTracking = disableTcpStateTracking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs new file mode 100644 index 000000000000..a531ed50f5ff --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs @@ -0,0 +1,21 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + { + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, string deleteOption) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + DeleteOption = deleteOption; + CustomInit(); + } + + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVM.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVM.cs new file mode 100644 index 000000000000..862e00cfb162 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVM.cs @@ -0,0 +1,198 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set virtual machine . + /// + public partial class VirtualMachineScaleSetVM : Resource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVM class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine instance ID. + /// The virtual machine SKU. + /// Specifies whether the latest model + /// has been applied to the virtual machine. + /// Azure VM unique ID. + /// The virtual machine instance + /// view. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine in the + /// scale set. For instance: whether the virtual machine has the + /// capability to support attaching managed data disks with + /// UltraSSD_LRS storage account type. + /// Specifies the operating system settings for + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the network + /// profile configuration of the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// <br><br> For more information on Azure planned + /// maintenance, see [Maintenance and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. An existing VM cannot be added + /// to an availability set. + /// The provisioning state, which only + /// appears in the response. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies whether the model + /// applied to the virtual machine is the model of the virtual machine + /// scale set or the customized model for the virtual machine. + /// Specifies the protection policy of + /// the virtual machine. + /// 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**. + /// The virtual machine child extension + /// resources. + /// The virtual machine zones. + public VirtualMachineScaleSetVM(string location, string id, string name, string type, IDictionary tags, string instanceId, Sku sku, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, Plan plan, IList resources, IList zones) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + Plan = plan; + Resources = resources; + Zones = zones; + CustomInit(); + } + + + public VirtualMachineScaleSetVM(string location, string id, string name, string type, IDictionary tags, string instanceId, Sku sku, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, Plan plan, IList resources) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + Plan = plan; + Resources = resources; + CustomInit(); + } + + + public VirtualMachineScaleSetVM(string location, string id, string name, string type, IDictionary tags, string instanceId, Sku sku, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, Plan plan) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + Plan = plan; + CustomInit(); + } + + + public VirtualMachineScaleSetVM(string location, string id, string name, string type, IDictionary tags, string instanceId, Sku sku, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + CustomInit(); + } + } + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtension.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtension.cs new file mode 100644 index 000000000000..fcc20a2e311d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtension.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + public partial class VirtualMachineScaleSetVMExtension : SubResourceReadOnly + { + public VirtualMachineScaleSetVMExtension(string name, string type, string forceUpdateTag, string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + public VirtualMachineScaleSetVMExtension(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(id) + { + Name = name; + Type = type; + Location = Location; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + public VirtualMachineScaleSetVMExtension(string id, string name, string type, string forceUpdateTag, string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + } +} \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtensionUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtensionUpdate.cs new file mode 100644 index 000000000000..884193d1750b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMExtensionUpdate.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.Compute.Models +{ + + public partial class VirtualMachineScaleSetVMExtensionUpdate : SubResourceReadOnly + { + public VirtualMachineScaleSetVMExtensionUpdate(string id = default(string), string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 000000000000..158501320902 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,602 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMsOperations : IServiceOperations, IVirtualMachineScaleSetVMsOperations + { + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-11-01"; + // Tracing + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters); + if (tempDisk != null) + { + vmScaleSetVMReimageInput = new VirtualMachineScaleSetVMReimageParameters(); + vmScaleSetVMReimageInput.TempDisk = tempDisk; + } + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmScaleSetVMReimageInput", vmScaleSetVMReimageInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if (vmScaleSetVMReimageInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmScaleSetVMReimageInput, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders, CancellationToken cancellationToken) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders) + { + // Send request + CancellationToken cancellationToken = default(CancellationToken); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders, CancellationToken cancellationToken) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-12-01"; + CancellationToken cancellationToken = default(CancellationToken); + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperationsExtensions.cs new file mode 100644 index 000000000000..2bc20b3c7a6e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMsOperations. + /// + public static partial class VirtualMachineScaleSetVMsOperationsExtensions + { + public static void Reimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk) + { + operations.ReimageAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk).GetAwaiter().GetResult(); + } + + public static async Task ReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + public static void BeginReimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk) + { + operations.BeginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk).GetAwaiter().GetResult(); + } + + public static async Task BeginReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? tempDisk, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperations.cs new file mode 100644 index 000000000000..f9da090268fa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperations.cs @@ -0,0 +1,933 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + internal partial class VirtualMachineScaleSetsOperations : IServiceOperations, IVirtualMachineScaleSetsOperations + { + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-03-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if (vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + public async Task> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, Dictionary> customHeaders, CancellationToken cancellationToken) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("platformUpdateDomain", platformUpdateDomain); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + _queryParameters.Add(string.Format("platformUpdateDomain={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(platformUpdateDomain, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders) + { + CancellationToken cancellationToken = default(CancellationToken); + + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName) + { + CancellationToken cancellationToken = default(CancellationToken); + Dictionary> customHeaders = null; + + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-03-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperationsExtensions.cs new file mode 100644 index 000000000000..bbfc3896f61d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineScaleSetsOperationsExtensions.cs @@ -0,0 +1,69 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetsOperations. + /// + public static partial class VirtualMachineScaleSetsOperationsExtensions + { + public static async Task ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, CancellationToken cancellationToken) + { + using (var _result = await operations.ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null).ConfigureAwait(false)) + { + return _result.Body; + } + } + } + + + +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineUpdate.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineUpdate.cs new file mode 100644 index 000000000000..fa1e21465dbb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachineUpdate.cs @@ -0,0 +1,778 @@ +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Update. + /// + public partial class VirtualMachineUpdate : UpdateResource + { + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, VirtualMachineIdentity identity, IList zones = default(IList)) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, VirtualMachineIdentity identity, IList zones) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Identity = identity; + Zones = zones; + CustomInit(); + } + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, VirtualMachineIdentity identity) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + Identity = identity; + CustomInit(); + } + + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, VirtualMachineIdentity identity, IList zones) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData, VirtualMachineIdentity identity) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + Identity = identity; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// 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). + /// <br><br> 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) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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). + /// <br><br> Minimum api-version: 2020-06-01 + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView , string licenseType, string vmId, string extensionsTimeBudget, VirtualMachineIdentity identity, IList zones) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Identity = identity; + Zones = zones; + CustomInit(); + } + + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, VirtualMachineIdentity identity) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + Identity = identity; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// <br><br> For more information on Azure planned + /// maintenance, see [Maintenance and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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). + /// <br><br> Minimum api-version: 2020-06-01 + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, VirtualMachineIdentity identity, IList zones) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + Identity = identity; + Zones = zones; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// <br><br> For more information on Azure planned + /// maintenance, see [Maintenance and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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). + /// <br><br> Minimum api-version: 2020-06-01 + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 + /// The identity of the virtual machine, if + /// configured. + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, VirtualMachineIdentity identity) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + Identity = identity; + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. <br><br>Minimum api-version: + /// 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// <br><br> For more information on Azure planned + /// maintenance, see [Maintenance and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + /// <br><br> Currently, a VM can only be added to + /// availability set at creation time. The availability set to which + /// the VM is being added should be under the same resource group as + /// the availability set resource. An existing VM cannot be added to an + /// availability set. <br><br>This property cannot exist + /// along with a non-null properties.virtualMachineScaleSet + /// reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. <br><br>This property cannot + /// exist along with a non-null properties.availabilitySet reference. + /// <br><br>Minimum api‐version: 2019‐03‐01 + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the priority for the virtual + /// machine. <br><br>Minimum api-version: 2019-03-01. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. + /// <br><br>For Azure Spot virtual machines, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2019-03-01. <br><br>For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. <br><br>Minimum + /// api-version: 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. <br><br>Minimum + /// api-version: 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. + /// <br><br>Minimum api-version: 2020-06-01. + /// <br><br>NOTE: User cannot specify both host and + /// hostGroup properties. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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). + /// <br><br> Minimum api-version: 2020-06-01 + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains.<br><li>This is applicable only if the + /// 'virtualMachineScaleSet' property of this Virtual Machine is + /// set.<li>The Virtual Machine Scale Set that is referenced, + /// must have 'platformFaultDomainCount' &gt; 1.<li>This + /// property cannot be updated once the Virtual Machine is + /// created.<li>Fault domain assignment can be viewed in the + /// Virtual Machine Instance View.<br><br>Minimum + /// api‐version: 2020‐12‐01 + public VirtualMachineUpdate(IDictionary tags, Plan plan, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, SubResource availabilitySet, SubResource virtualMachineScaleSet, SubResource proximityPlacementGroup, string priority, string evictionPolicy, BillingProfile billingProfile, SubResource host, SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + CustomInit(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperations.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperations.cs new file mode 100644 index 000000000000..dc66909f17a6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperations.cs @@ -0,0 +1,618 @@ +namespace Microsoft.Azure.Management.Compute +{ + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Azure.Management.Compute.Models; + using System.Net.Http; + using Newtonsoft.Json; + using System.Linq; + using System.Net; + + /// + /// VirtualMachinesOperations operations. + /// + internal partial class VirtualMachinesOperations : IServiceOperations, IVirtualMachinesOperations + { + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? tempDisk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? tempDisk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-11-01"; + VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters); + if (tempDisk != null) + { + parameters = new VirtualMachineReimageParameters(); + parameters.TempDisk = tempDisk; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if (parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + public async Task>> ListAllWithHttpMessagesAsync(string statusOnly, Dictionary> customHeaders, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statusOnly", statusOnly); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (statusOnly != null) + { + _queryParameters.Add(string.Format("statusOnly={0}", System.Uri.EscapeDataString(statusOnly))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach (var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders) + { + return await DeleteWithHttpMessagesAsync(resourceGroupName, vmName, false, customHeaders, default(CancellationToken)); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await DeleteWithHttpMessagesAsync(resourceGroupName, vmName, false, customHeaders, cancellationToken); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders) + { + return await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, false, customHeaders, default(CancellationToken)); + } + + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, false, customHeaders, cancellationToken); + } + + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await DeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, customHeaders, cancellationToken); + } + + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders) + { + return await DeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, customHeaders, default(CancellationToken)); + } + + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders, CancellationToken cancellationToken) + { + return await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, customHeaders, cancellationToken); + } + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders) + { + return await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, null, customHeaders, default(CancellationToken)); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 000000000000..144fc71115fa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Customizations/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,125 @@ +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachinesOperations. + /// + public static partial class VirtualMachinesOperationsExtensions + { + public static void Reimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk) + { + operations.ReimageAsync(resourceGroupName, vmName, tempDisk).GetAwaiter().GetResult(); + } + + public static async Task ReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + public static void BeginReimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk) + { + operations.BeginReimageAsync(resourceGroupName, vmName, tempDisk).GetAwaiter().GetResult(); + } + + public static async Task BeginReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? tempDisk, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, tempDisk, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + public static async Task> ListAsync(this IVirtualMachinesOperations operations, string resourceGroupName, CancellationToken cancellationToken) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + public static async Task> ListAllAsync(this IVirtualMachinesOperations operations, string statusOnly, CancellationToken cancellationToken) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(statusOnly, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + await DeleteAsync(operations, resourceGroupName, vmName, false, default(CancellationToken)); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken) + { + await DeleteAsync(operations, resourceGroupName, vmName, false, cancellationToken); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + await BeginDeleteAsync(operations, resourceGroupName, vmName, false, default(CancellationToken)); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken) + { + await BeginDeleteAsync(operations, resourceGroupName, vmName, false, cancellationToken); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperations.cs new file mode 100644 index 000000000000..8ae0ac1b0b4f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperations.cs @@ -0,0 +1,1752 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailabilitySetsOperations operations. + /// + internal partial class AvailabilitySetsOperations : IServiceOperations, IAvailabilitySetsOperations + { + /// + /// Initializes a new instance of the AvailabilitySetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailabilitySetsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (availabilitySetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "availabilitySetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("availabilitySetName", availabilitySetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAvailableSizes", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{availabilitySetName}", System.Uri.EscapeDataString(availabilitySetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperationsExtensions.cs new file mode 100644 index 000000000000..b65d43682dac --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/AvailabilitySetsOperationsExtensions.cs @@ -0,0 +1,376 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AvailabilitySetsOperations. + /// + public static partial class AvailabilitySetsOperationsExtensions + { + /// + /// Create or update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + public static AvailabilitySet CreateOrUpdate(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySet parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, availabilitySetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, availabilitySetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + public static AvailabilitySet Update(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, availabilitySetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, availabilitySetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static void Delete(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + operations.DeleteAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Delete an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static AvailabilitySet Get(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + return operations.GetAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + public static IPage ListBySubscription(this IAvailabilitySetsOperations operations, string expand = default(string)) + { + return operations.ListBySubscriptionAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IAvailabilitySetsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IAvailabilitySetsOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + public static IEnumerable ListAvailableSizes(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName) + { + return operations.ListAvailableSizesAsync(resourceGroupName, availabilitySetName).GetAwaiter().GetResult(); + } + + /// + /// Lists all available virtual machine sizes that can be used to create a new + /// virtual machine in an existing availability set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAvailableSizesAsync(this IAvailabilitySetsOperations operations, string resourceGroupName, string availabilitySetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAvailableSizesWithHttpMessagesAsync(resourceGroupName, availabilitySetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IAvailabilitySetsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IAvailabilitySetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAvailabilitySetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IAvailabilitySetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperations.cs new file mode 100644 index 000000000000..cbf7113436a9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperations.cs @@ -0,0 +1,1620 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CapacityReservationGroupsOperations operations. + /// + internal partial class CapacityReservationGroupsOperations : IServiceOperations, ICapacityReservationGroupsOperations + { + /// + /// Initializes a new instance of the CapacityReservationGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CapacityReservationGroupsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update a capacity reservation group. When + /// updating a capacity reservation group, only tags may be modified. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Parameters supplied to the Create capacity reservation Group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, CapacityReservationGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update a capacity reservation group. When updating a + /// capacity reservation group, only tags may be modified. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Resource tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + CapacityReservationGroupUpdate parameters = new CapacityReservationGroupUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a capacity reservation group. This operation is + /// allowed only if all the associated resources are disassociated from the + /// reservation group and all capacity reservations under the reservation group + /// have also been deleted. Please refer to https://aka.ms/CapacityReservation + /// for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation that retrieves information about a capacity reservation + /// group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the capacity reservations under the + /// capacity reservation group which is a snapshot of the runtime properties of + /// a capacity reservation that is managed by the platform and can change + /// outside of control plane operations. Possible values include: + /// 'instanceView' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The name of the resource group. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..833108d61ef7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationGroupsOperationsExtensions.cs @@ -0,0 +1,402 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CapacityReservationGroupsOperations. + /// + public static partial class CapacityReservationGroupsOperationsExtensions + { + /// + /// The operation to create or update a capacity reservation group. When + /// updating a capacity reservation group, only tags may be modified. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Parameters supplied to the Create capacity reservation Group. + /// + public static CapacityReservationGroup CreateOrUpdate(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, CapacityReservationGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, capacityReservationGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a capacity reservation group. When + /// updating a capacity reservation group, only tags may be modified. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Parameters supplied to the Create capacity reservation Group. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, CapacityReservationGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a capacity reservation group. When updating a + /// capacity reservation group, only tags may be modified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Resource tags + /// + public static CapacityReservationGroup Update(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, capacityReservationGroupName, tags).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a capacity reservation group. When updating a + /// capacity reservation group, only tags may be modified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a capacity reservation group. This operation is + /// allowed only if all the associated resources are disassociated from the + /// reservation group and all capacity reservations under the reservation group + /// have also been deleted. Please refer to https://aka.ms/CapacityReservation + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + public static void Delete(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName) + { + operations.DeleteAsync(resourceGroupName, capacityReservationGroupName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a capacity reservation group. This operation is + /// allowed only if all the associated resources are disassociated from the + /// reservation group and all capacity reservations under the reservation group + /// have also been deleted. Please refer to https://aka.ms/CapacityReservation + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation that retrieves information about a capacity reservation + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the capacity reservations under the + /// capacity reservation group which is a snapshot of the runtime properties of + /// a capacity reservation that is managed by the platform and can change + /// outside of control plane operations. Possible values include: + /// 'instanceView' + /// + public static CapacityReservationGroup Get(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, capacityReservationGroupName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation that retrieves information about a capacity reservation + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the capacity reservations under the + /// capacity reservation group which is a snapshot of the runtime properties of + /// a capacity reservation that is managed by the platform and can change + /// outside of control plane operations. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string capacityReservationGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + public static IPage ListByResourceGroup(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string expand = default(string)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ICapacityReservationGroupsOperations operations, string resourceGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + public static IPage ListBySubscription(this ICapacityReservationGroupsOperations operations, string expand = default(string)) + { + return operations.ListBySubscriptionAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The expand expression to apply on the operation. Based on the expand + /// param(s) specified we return Virtual Machine or ScaleSet VM Instance or + /// both resource Ids which are associated to capacity reservation group in the + /// response. Possible values include: 'virtualMachineScaleSetVMs/$ref', + /// 'virtualMachines/$ref' + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ICapacityReservationGroupsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ICapacityReservationGroupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservation groups in the specified resource + /// group. Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ICapacityReservationGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ICapacityReservationGroupsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the + /// nextLink property in the response to get the next page of capacity + /// reservation groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ICapacityReservationGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperations.cs new file mode 100644 index 000000000000..5b6d61876e59 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperations.cs @@ -0,0 +1,1368 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CapacityReservationsOperations operations. + /// + internal partial class CapacityReservationsOperations : IServiceOperations, ICapacityReservationsOperations + { + /// + /// Initializes a new instance of the CapacityReservationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CapacityReservationsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation that retrieves information about the capacity reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the capacity reservation that is + /// managed by the platform and can change outside of control plane operations. + /// Possible values include: 'instanceView' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (capacityReservationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("capacityReservationName", capacityReservationName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{capacityReservationName}", System.Uri.EscapeDataString(capacityReservationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCapacityReservationGroupWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCapacityReservationGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (capacityReservationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("capacityReservationName", capacityReservationName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{capacityReservationName}", System.Uri.EscapeDataString(capacityReservationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (capacityReservationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("capacityReservationName", capacityReservationName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{capacityReservationName}", System.Uri.EscapeDataString(capacityReservationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (capacityReservationGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationGroupName"); + } + if (capacityReservationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "capacityReservationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("capacityReservationGroupName", capacityReservationGroupName); + tracingParameters.Add("capacityReservationName", capacityReservationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{capacityReservationGroupName}", System.Uri.EscapeDataString(capacityReservationGroupName)); + _url = _url.Replace("{capacityReservationName}", System.Uri.EscapeDataString(capacityReservationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCapacityReservationGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCapacityReservationGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperationsExtensions.cs new file mode 100644 index 000000000000..809751692ac2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CapacityReservationsOperationsExtensions.cs @@ -0,0 +1,479 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CapacityReservationsOperations. + /// + public static partial class CapacityReservationsOperationsExtensions + { + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + public static CapacityReservation CreateOrUpdate(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + public static CapacityReservation Update(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + public static void Delete(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName) + { + operations.DeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation that retrieves information about the capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the capacity reservation that is + /// managed by the platform and can change outside of control plane operations. + /// Possible values include: 'instanceView' + /// + public static CapacityReservation Get(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation that retrieves information about the capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the capacity reservation that is + /// managed by the platform and can change outside of control plane operations. + /// Possible values include: 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + public static IPage ListByCapacityReservationGroup(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName) + { + return operations.ListByCapacityReservationGroupAsync(resourceGroupName, capacityReservationGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCapacityReservationGroupAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCapacityReservationGroupWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + public static CapacityReservation BeginCreateOrUpdate(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a capacity reservation. Please note some + /// properties can be set only during capacity reservation creation. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + public static CapacityReservation BeginUpdate(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a capacity reservation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + public static void BeginDelete(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName) + { + operations.BeginDeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a capacity reservation. This operation is allowed + /// only when all the associated resources are disassociated from the capacity + /// reservation. Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICapacityReservationsOperations operations, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCapacityReservationGroupNext(this ICapacityReservationsOperations operations, string nextPageLink) + { + return operations.ListByCapacityReservationGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get the + /// next page of capacity reservations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCapacityReservationGroupNextAsync(this ICapacityReservationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCapacityReservationGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperations.cs new file mode 100644 index 000000000000..d4519a5c8c56 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperations.cs @@ -0,0 +1,1172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceOperatingSystemsOperations operations. + /// + internal partial class CloudServiceOperatingSystemsOperations : IServiceOperations, ICloudServiceOperatingSystemsOperations + { + /// + /// Initializes a new instance of the CloudServiceOperatingSystemsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServiceOperatingSystemsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets properties of a guest operating system version that can be specified + /// in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Name of the location that the OS version pertains to. + /// + /// + /// Name of the OS version. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOSVersionWithHttpMessagesAsync(string location, string osVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (osVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "osVersionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("osVersionName", osVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOSVersion", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{osVersionName}", System.Uri.EscapeDataString(osVersionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// Name of the location that the OS versions pertain to. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOSVersionsWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOSVersions", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets properties of a guest operating system family that can be specified in + /// the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Name of the location that the OS family pertains to. + /// + /// + /// Name of the OS family. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOSFamilyWithHttpMessagesAsync(string location, string osFamilyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (osFamilyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "osFamilyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("osFamilyName", osFamilyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOSFamily", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{osFamilyName}", System.Uri.EscapeDataString(osFamilyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// Name of the location that the OS families pertain to. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOSFamiliesWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOSFamilies", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOSVersionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOSVersionsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOSFamiliesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOSFamiliesNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperationsExtensions.cs new file mode 100644 index 000000000000..524d3e158568 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceOperatingSystemsOperationsExtensions.cs @@ -0,0 +1,269 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServiceOperatingSystemsOperations. + /// + public static partial class CloudServiceOperatingSystemsOperationsExtensions + { + /// + /// Gets properties of a guest operating system version that can be specified + /// in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS version pertains to. + /// + /// + /// Name of the OS version. + /// + public static OSVersion GetOSVersion(this ICloudServiceOperatingSystemsOperations operations, string location, string osVersionName) + { + return operations.GetOSVersionAsync(location, osVersionName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a guest operating system version that can be specified + /// in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS version pertains to. + /// + /// + /// Name of the OS version. + /// + /// + /// The cancellation token. + /// + public static async Task GetOSVersionAsync(this ICloudServiceOperatingSystemsOperations operations, string location, string osVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSVersionWithHttpMessagesAsync(location, osVersionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS versions pertain to. + /// + public static IPage ListOSVersions(this ICloudServiceOperatingSystemsOperations operations, string location) + { + return operations.ListOSVersionsAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS versions pertain to. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOSVersionsAsync(this ICloudServiceOperatingSystemsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOSVersionsWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a guest operating system family that can be specified in + /// the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS family pertains to. + /// + /// + /// Name of the OS family. + /// + public static OSFamily GetOSFamily(this ICloudServiceOperatingSystemsOperations operations, string location, string osFamilyName) + { + return operations.GetOSFamilyAsync(location, osFamilyName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a guest operating system family that can be specified in + /// the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS family pertains to. + /// + /// + /// Name of the OS family. + /// + /// + /// The cancellation token. + /// + public static async Task GetOSFamilyAsync(this ICloudServiceOperatingSystemsOperations operations, string location, string osFamilyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSFamilyWithHttpMessagesAsync(location, osFamilyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS families pertain to. + /// + public static IPage ListOSFamilies(this ICloudServiceOperatingSystemsOperations operations, string location) + { + return operations.ListOSFamiliesAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the location that the OS families pertain to. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOSFamiliesAsync(this ICloudServiceOperatingSystemsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOSFamiliesWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOSVersionsNext(this ICloudServiceOperatingSystemsOperations operations, string nextPageLink) + { + return operations.ListOSVersionsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS versions. + /// Do this till nextLink is null to fetch all the OS versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOSVersionsNextAsync(this ICloudServiceOperatingSystemsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOSVersionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOSFamiliesNext(this ICloudServiceOperatingSystemsOperations operations, string nextPageLink) + { + return operations.ListOSFamiliesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud service. + /// Use nextLink property in the response to get the next page of OS Families. + /// Do this till nextLink is null to fetch all the OS Families. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOSFamiliesNextAsync(this ICloudServiceOperatingSystemsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOSFamiliesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperations.cs new file mode 100644 index 000000000000..e7d488cd6e8b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperations.cs @@ -0,0 +1,1881 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRoleInstancesOperations operations. + /// + internal partial class CloudServiceRoleInstancesOperations : IServiceOperations, ICloudServiceRoleInstancesOperations + { + /// + /// Initializes a new instance of the CloudServiceRoleInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServiceRoleInstancesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetRemoteDesktopFileWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRemoteDesktopFile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRebuild", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild").ToString(); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..d93d8dcd6922 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRoleInstancesOperationsExtensions.cs @@ -0,0 +1,631 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServiceRoleInstancesOperations. + /// + public static partial class CloudServiceRoleInstancesOperationsExtensions + { + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Delete(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.DeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + public static RoleInstance Get(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static RoleInstanceInstanceView GetInstanceView(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + return operations.GetInstanceViewAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the run-time state of a role instance in a + /// cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + public static IPage List(this ICloudServiceRoleInstancesOperations operations, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.ListAsync(resourceGroupName, cloudServiceName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServiceRoleInstancesOperations operations, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, cloudServiceName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Restart(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.RestartAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Reimage(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.ReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Rebuild(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.RebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RebuildAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static Stream GetRemoteDesktopFile(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + return operations.GetRemoteDesktopFileAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetRemoteDesktopFileAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.GetRemoteDesktopFileWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginDelete(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginRestart(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reboot Role Instance asynchronous operation requests a reboot of a role + /// instance in the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginReimage(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Reimage Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginRebuild(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName) + { + operations.BeginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the operating + /// system on instances of web roles or worker roles and initializes the + /// storage resources that are used by them. If you do not want to initialize + /// storage resources, you can use Reimage Role Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRebuildAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRebuildWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServiceRoleInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of all role instances in a cloud service. Use nextLink + /// property in the response to get the next page of role instances. Do this + /// till nextLink is null to fetch all the role instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServiceRoleInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperations.cs new file mode 100644 index 000000000000..d35b939bc199 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperations.cs @@ -0,0 +1,628 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRolesOperations operations. + /// + internal partial class CloudServiceRolesOperations : IServiceOperations, ICloudServiceRolesOperations + { + /// + /// Initializes a new instance of the CloudServiceRolesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServiceRolesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a role from a cloud service. + /// + /// + /// Name of the role. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string roleName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (roleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("roleName", roleName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}").ToString(); + _url = _url.Replace("{roleName}", System.Uri.EscapeDataString(roleName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperationsExtensions.cs new file mode 100644 index 000000000000..c86e95e15acb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServiceRolesOperationsExtensions.cs @@ -0,0 +1,153 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServiceRolesOperations. + /// + public static partial class CloudServiceRolesOperationsExtensions + { + /// + /// Gets a role from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static CloudServiceRole Get(this ICloudServiceRolesOperations operations, string roleName, string resourceGroupName, string cloudServiceName) + { + return operations.GetAsync(roleName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role from a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the role. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServiceRolesOperations operations, string roleName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(roleName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static IPage List(this ICloudServiceRolesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServiceRolesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServiceRolesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all roles in a cloud service. Use nextLink property in the + /// response to get the next page of roles. Do this till nextLink is null to + /// fetch all the roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServiceRolesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperations.cs new file mode 100644 index 000000000000..3ba1d07dd5aa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperations.cs @@ -0,0 +1,3122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesOperations operations. + /// + internal partial class CloudServicesOperations : IServiceOperations, ICloudServicesOperations + { + /// + /// Initializes a new instance of the CloudServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServicesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// Name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + CloudServiceUpdate parameters = default(CloudServiceUpdate); + if (tags != null) + { + parameters = new CloudServiceUpdate(); + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPowerOff", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2022-09-04"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2022-09-04"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2022-09-04"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRebuild", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (roleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstancesProperty"); + } + string apiVersion = "2022-09-04"; + RoleInstances parameters = default(RoleInstances); + if (roleInstancesProperty != null) + { + parameters = new RoleInstances(); + parameters.RoleInstancesProperty = roleInstancesProperty; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteInstances", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperationsExtensions.cs new file mode 100644 index 000000000000..84568a13d4c1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesOperationsExtensions.cs @@ -0,0 +1,1047 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServicesOperations. + /// + public static partial class CloudServicesOperationsExtensions + { + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + public static CloudService CreateOrUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + public static CloudService Update(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, cloudServiceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Delete(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.DeleteAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Display information about a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static CloudService Get(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.GetAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Display information about a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static CloudServiceInstanceView GetInstanceView(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.GetInstanceViewAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this ICloudServicesOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this ICloudServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + public static IPage List(this ICloudServicesOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICloudServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void Start(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.StartAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void PowerOff(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.PowerOffAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Restart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.RestartAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Reimage(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.ReimageAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void Rebuild(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.RebuildAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task RebuildAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void DeleteInstances(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.DeleteInstancesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInstancesAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + public static CloudService BeginCreateOrUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a cloud service. Please note some properties can be set + /// only during cloud service creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + public static CloudService BeginUpdate(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, cloudServiceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, cloudServiceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginDelete(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginDeleteAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginStart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginStartAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static void BeginPowerOff(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName) + { + operations.BeginPowerOffAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Power off the cloud service. Note that resources are still attached and you + /// are getting charged for the resources. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginRestart(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginRestartAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginReimage(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginReimageAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Reimage asynchronous operation reinstalls the operating system on instances + /// of web roles or worker roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginRebuild(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginRebuildAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Rebuild Role Instances reinstalls the operating system on instances of web + /// roles or worker roles and initializes the storage resources that are used + /// by them. If you do not want to initialize storage resources, you can use + /// Reimage Role Instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRebuildAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRebuildWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + public static void BeginDeleteInstances(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty) + { + operations.BeginDeleteInstancesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty).GetAwaiter().GetResult(); + } + + /// + /// Deletes role instances in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will signify all + /// role instances of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteInstancesAsync(this ICloudServicesOperations operations, string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstancesProperty, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this ICloudServicesOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of Cloud Services. Do this till nextLink is null to fetch all the + /// Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this ICloudServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICloudServicesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all cloud services under a resource group. Use nextLink + /// property in the response to get the next page of Cloud Services. Do this + /// till nextLink is null to fetch all the Cloud Services. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICloudServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperations.cs new file mode 100644 index 000000000000..60a960bcb687 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperations.cs @@ -0,0 +1,839 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesUpdateDomainOperations operations. + /// + internal partial class CloudServicesUpdateDomainOperations : IServiceOperations, ICloudServicesUpdateDomainOperations + { + /// + /// Initializes a new instance of the CloudServicesUpdateDomainOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CloudServicesUpdateDomainOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task WalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginWalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("updateDomain", updateDomain); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpdateDomain", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{updateDomain}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(updateDomain, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListUpdateDomainsWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListUpdateDomains", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginWalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-09-04"; + UpdateDomain parameters = default(UpdateDomain); + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("updateDomain", updateDomain); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginWalkUpdateDomain", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{updateDomain}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(updateDomain, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListUpdateDomainsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListUpdateDomainsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperationsExtensions.cs new file mode 100644 index 000000000000..9e3226415fe1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CloudServicesUpdateDomainOperationsExtensions.cs @@ -0,0 +1,247 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CloudServicesUpdateDomainOperations. + /// + public static partial class CloudServicesUpdateDomainOperationsExtensions + { + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static void WalkUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + operations.WalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task WalkUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.WalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static UpdateDomain GetUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + return operations.GetUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified update domain of a cloud service. Use nextLink property + /// in the response to get the next page of update domains. Do this till + /// nextLink is null to fetch all the update domains. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task GetUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + public static IPage ListUpdateDomains(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListUpdateDomainsAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListUpdateDomainsAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListUpdateDomainsWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + public static void BeginWalkUpdateDomain(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain) + { + operations.BeginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).GetAwaiter().GetResult(); + } + + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. Update + /// domains are identified with a zero-based index: the first update domain has + /// an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The cancellation token. + /// + public static async Task BeginWalkUpdateDomainAsync(this ICloudServicesUpdateDomainOperations operations, string resourceGroupName, string cloudServiceName, int updateDomain, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginWalkUpdateDomainWithHttpMessagesAsync(resourceGroupName, cloudServiceName, updateDomain, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListUpdateDomainsNext(this ICloudServicesUpdateDomainOperations operations, string nextPageLink) + { + return operations.ListUpdateDomainsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListUpdateDomainsNextAsync(this ICloudServicesUpdateDomainOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListUpdateDomainsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperations.cs new file mode 100644 index 000000000000..013f821aab47 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperations.cs @@ -0,0 +1,248 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleriesOperations operations. + /// + internal partial class CommunityGalleriesOperations : IServiceOperations, ICommunityGalleriesOperations + { + /// + /// Initializes a new instance of the CommunityGalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleriesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperationsExtensions.cs new file mode 100644 index 000000000000..c36d2a2c4d75 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleriesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleriesOperations. + /// + public static partial class CommunityGalleriesOperationsExtensions + { + /// + /// Get a community gallery by gallery public name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + public static CommunityGallery Get(this ICommunityGalleriesOperations operations, string location, string publicGalleryName) + { + return operations.GetAsync(location, publicGalleryName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleriesOperations operations, string location, string publicGalleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..ba9d415062da --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperations.cs @@ -0,0 +1,645 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImageVersionsOperations operations. + /// + internal partial class CommunityGalleryImageVersionsOperations : IServiceOperations, ICommunityGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the CommunityGalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleryImageVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery image version. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..1227052f43f6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImageVersionsOperationsExtensions.cs @@ -0,0 +1,163 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleryImageVersionsOperations. + /// + public static partial class CommunityGalleryImageVersionsOperationsExtensions + { + /// + /// Get a community gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + public static CommunityGalleryImageVersion Get(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName) + { + return operations.GetAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow semantic + /// version name pattern: The allowed characters are digit and period. Digits + /// must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + public static IPage List(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName) + { + return operations.ListAsync(location, publicGalleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICommunityGalleryImageVersionsOperations operations, string location, string publicGalleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, publicGalleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICommunityGalleryImageVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List community gallery image versions inside an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICommunityGalleryImageVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperations.cs new file mode 100644 index 000000000000..2d539e9fe29a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperations.cs @@ -0,0 +1,624 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImagesOperations operations. + /// + internal partial class CommunityGalleryImagesOperations : IServiceOperations, ICommunityGalleryImagesOperations + { + /// + /// Initializes a new instance of the CommunityGalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommunityGalleryImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get a community gallery image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publicGalleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicGalleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("publicGalleryName", publicGalleryName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publicGalleryName}", System.Uri.EscapeDataString(publicGalleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..0cb768ca6313 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/CommunityGalleryImagesOperationsExtensions.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommunityGalleryImagesOperations. + /// + public static partial class CommunityGalleryImagesOperationsExtensions + { + /// + /// Get a community gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + public static CommunityGalleryImage Get(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName, string galleryImageName) + { + return operations.GetAsync(location, publicGalleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Get a community gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publicGalleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + public static IPage List(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName) + { + return operations.ListAsync(location, publicGalleryName).GetAwaiter().GetResult(); + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICommunityGalleryImagesOperations operations, string location, string publicGalleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, publicGalleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICommunityGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List community gallery images inside a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ICommunityGalleryImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ComputeManagementClient.cs b/src/Compute/Compute.Management.Sdk/Generated/ComputeManagementClient.cs new file mode 100644 index 000000000000..ff91e22a1463 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ComputeManagementClient.cs @@ -0,0 +1,641 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + public partial class ComputeManagementClient : ServiceClient, IComputeManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Subscription credentials which uniquely identify Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IUsageOperations. + /// + public virtual IUsageOperations Usage { get; private set; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + public virtual IVirtualMachineSizesOperations VirtualMachineSizes { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + public virtual IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetExtensionsOperations. + /// + public virtual IVirtualMachineScaleSetExtensionsOperations VirtualMachineScaleSetExtensions { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetRollingUpgradesOperations. + /// + public virtual IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + public virtual IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetVMsOperations. + /// + public virtual IVirtualMachineScaleSetVMsOperations VirtualMachineScaleSetVMs { get; private set; } + + /// + /// Gets the IVirtualMachineExtensionsOperations. + /// + public virtual IVirtualMachineExtensionsOperations VirtualMachineExtensions { get; private set; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } + + /// + /// Gets the IVirtualMachineImagesOperations. + /// + public virtual IVirtualMachineImagesOperations VirtualMachineImages { get; private set; } + + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + public virtual IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; private set; } + + /// + /// Gets the IVirtualMachineExtensionImagesOperations. + /// + public virtual IVirtualMachineExtensionImagesOperations VirtualMachineExtensionImages { get; private set; } + + /// + /// Gets the IAvailabilitySetsOperations. + /// + public virtual IAvailabilitySetsOperations AvailabilitySets { get; private set; } + + /// + /// Gets the IProximityPlacementGroupsOperations. + /// + public virtual IProximityPlacementGroupsOperations ProximityPlacementGroups { get; private set; } + + /// + /// Gets the IDedicatedHostGroupsOperations. + /// + public virtual IDedicatedHostGroupsOperations DedicatedHostGroups { get; private set; } + + /// + /// Gets the IDedicatedHostsOperations. + /// + public virtual IDedicatedHostsOperations DedicatedHosts { get; private set; } + + /// + /// Gets the ISshPublicKeysOperations. + /// + public virtual ISshPublicKeysOperations SshPublicKeys { get; private set; } + + /// + /// Gets the IImagesOperations. + /// + public virtual IImagesOperations Images { get; private set; } + + /// + /// Gets the IRestorePointCollectionsOperations. + /// + public virtual IRestorePointCollectionsOperations RestorePointCollections { get; private set; } + + /// + /// Gets the IRestorePointsOperations. + /// + public virtual IRestorePointsOperations RestorePoints { get; private set; } + + /// + /// Gets the ICapacityReservationGroupsOperations. + /// + public virtual ICapacityReservationGroupsOperations CapacityReservationGroups { get; private set; } + + /// + /// Gets the ICapacityReservationsOperations. + /// + public virtual ICapacityReservationsOperations CapacityReservations { get; private set; } + + /// + /// Gets the ILogAnalyticsOperations. + /// + public virtual ILogAnalyticsOperations LogAnalytics { get; private set; } + + /// + /// Gets the IVirtualMachineRunCommandsOperations. + /// + public virtual IVirtualMachineRunCommandsOperations VirtualMachineRunCommands { get; private set; } + + /// + /// Gets the IVirtualMachineScaleSetVMRunCommandsOperations. + /// + public virtual IVirtualMachineScaleSetVMRunCommandsOperations VirtualMachineScaleSetVMRunCommands { get; private set; } + + /// + /// Gets the IDisksOperations. + /// + public virtual IDisksOperations Disks { get; private set; } + + /// + /// Gets the IDiskAccessesOperations. + /// + public virtual IDiskAccessesOperations DiskAccesses { get; private set; } + + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + public virtual IDiskEncryptionSetsOperations DiskEncryptionSets { get; private set; } + + /// + /// Gets the IDiskRestorePointOperations. + /// + public virtual IDiskRestorePointOperations DiskRestorePoint { get; private set; } + + /// + /// Gets the ISnapshotsOperations. + /// + public virtual ISnapshotsOperations Snapshots { get; private set; } + + /// + /// Gets the IResourceSkusOperations. + /// + public virtual IResourceSkusOperations ResourceSkus { get; private set; } + + /// + /// Gets the IGalleriesOperations. + /// + public virtual IGalleriesOperations Galleries { get; private set; } + + /// + /// Gets the IGalleryImagesOperations. + /// + public virtual IGalleryImagesOperations GalleryImages { get; private set; } + + /// + /// Gets the IGalleryImageVersionsOperations. + /// + public virtual IGalleryImageVersionsOperations GalleryImageVersions { get; private set; } + + /// + /// Gets the IGalleryApplicationsOperations. + /// + public virtual IGalleryApplicationsOperations GalleryApplications { get; private set; } + + /// + /// Gets the IGalleryApplicationVersionsOperations. + /// + public virtual IGalleryApplicationVersionsOperations GalleryApplicationVersions { get; private set; } + + /// + /// Gets the IGallerySharingProfileOperations. + /// + public virtual IGallerySharingProfileOperations GallerySharingProfile { get; private set; } + + /// + /// Gets the ISharedGalleriesOperations. + /// + public virtual ISharedGalleriesOperations SharedGalleries { get; private set; } + + /// + /// Gets the ISharedGalleryImagesOperations. + /// + public virtual ISharedGalleryImagesOperations SharedGalleryImages { get; private set; } + + /// + /// Gets the ISharedGalleryImageVersionsOperations. + /// + public virtual ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; private set; } + + /// + /// Gets the ICommunityGalleriesOperations. + /// + public virtual ICommunityGalleriesOperations CommunityGalleries { get; private set; } + + /// + /// Gets the ICommunityGalleryImagesOperations. + /// + public virtual ICommunityGalleryImagesOperations CommunityGalleryImages { get; private set; } + + /// + /// Gets the ICommunityGalleryImageVersionsOperations. + /// + public virtual ICommunityGalleryImageVersionsOperations CommunityGalleryImageVersions { get; private set; } + + /// + /// Gets the ICloudServiceRoleInstancesOperations. + /// + public virtual ICloudServiceRoleInstancesOperations CloudServiceRoleInstances { get; private set; } + + /// + /// Gets the ICloudServiceRolesOperations. + /// + public virtual ICloudServiceRolesOperations CloudServiceRoles { get; private set; } + + /// + /// Gets the ICloudServicesOperations. + /// + public virtual ICloudServicesOperations CloudServices { get; private set; } + + /// + /// Gets the ICloudServicesUpdateDomainOperations. + /// + public virtual ICloudServicesUpdateDomainOperations CloudServicesUpdateDomain { get; private set; } + + /// + /// Gets the ICloudServiceOperatingSystemsOperations. + /// + public virtual ICloudServiceOperatingSystemsOperations CloudServiceOperatingSystems { get; private set; } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ComputeManagementClient.Dispose(). False: will not dispose provided httpClient + protected ComputeManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ComputeManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ComputeManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ComputeManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ComputeManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ComputeManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ComputeManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ComputeManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + Usage = new UsageOperations(this); + VirtualMachineSizes = new VirtualMachineSizesOperations(this); + VirtualMachineScaleSets = new VirtualMachineScaleSetsOperations(this); + VirtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsOperations(this); + VirtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesOperations(this); + VirtualMachineScaleSetVMExtensions = new VirtualMachineScaleSetVMExtensionsOperations(this); + VirtualMachineScaleSetVMs = new VirtualMachineScaleSetVMsOperations(this); + VirtualMachineExtensions = new VirtualMachineExtensionsOperations(this); + VirtualMachines = new VirtualMachinesOperations(this); + VirtualMachineImages = new VirtualMachineImagesOperations(this); + VirtualMachineImagesEdgeZone = new VirtualMachineImagesEdgeZoneOperations(this); + VirtualMachineExtensionImages = new VirtualMachineExtensionImagesOperations(this); + AvailabilitySets = new AvailabilitySetsOperations(this); + ProximityPlacementGroups = new ProximityPlacementGroupsOperations(this); + DedicatedHostGroups = new DedicatedHostGroupsOperations(this); + DedicatedHosts = new DedicatedHostsOperations(this); + SshPublicKeys = new SshPublicKeysOperations(this); + Images = new ImagesOperations(this); + RestorePointCollections = new RestorePointCollectionsOperations(this); + RestorePoints = new RestorePointsOperations(this); + CapacityReservationGroups = new CapacityReservationGroupsOperations(this); + CapacityReservations = new CapacityReservationsOperations(this); + LogAnalytics = new LogAnalyticsOperations(this); + VirtualMachineRunCommands = new VirtualMachineRunCommandsOperations(this); + VirtualMachineScaleSetVMRunCommands = new VirtualMachineScaleSetVMRunCommandsOperations(this); + Disks = new DisksOperations(this); + DiskAccesses = new DiskAccessesOperations(this); + DiskEncryptionSets = new DiskEncryptionSetsOperations(this); + DiskRestorePoint = new DiskRestorePointOperations(this); + Snapshots = new SnapshotsOperations(this); + ResourceSkus = new ResourceSkusOperations(this); + Galleries = new GalleriesOperations(this); + GalleryImages = new GalleryImagesOperations(this); + GalleryImageVersions = new GalleryImageVersionsOperations(this); + GalleryApplications = new GalleryApplicationsOperations(this); + GalleryApplicationVersions = new GalleryApplicationVersionsOperations(this); + GallerySharingProfile = new GallerySharingProfileOperations(this); + SharedGalleries = new SharedGalleriesOperations(this); + SharedGalleryImages = new SharedGalleryImagesOperations(this); + SharedGalleryImageVersions = new SharedGalleryImageVersionsOperations(this); + CommunityGalleries = new CommunityGalleriesOperations(this); + CommunityGalleryImages = new CommunityGalleryImagesOperations(this); + CommunityGalleryImageVersions = new CommunityGalleryImageVersionsOperations(this); + CloudServiceRoleInstances = new CloudServiceRoleInstancesOperations(this); + CloudServiceRoles = new CloudServiceRolesOperations(this); + CloudServices = new CloudServicesOperations(this); + CloudServicesUpdateDomain = new CloudServicesUpdateDomainOperations(this); + CloudServiceOperatingSystems = new CloudServiceOperatingSystemsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperations.cs new file mode 100644 index 000000000000..dee6a5fa1852 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperations.cs @@ -0,0 +1,1587 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DedicatedHostGroupsOperations operations. + /// + internal partial class DedicatedHostGroupsOperations : IServiceOperations, IDedicatedHostGroupsOperations + { + /// + /// Initializes a new instance of the DedicatedHostGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DedicatedHostGroupsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// 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) + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update an dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated hosts under the + /// dedicated host group. 'UserData' is not supported for dedicated host group. + /// Possible values include: 'instanceView', 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..1680f78d1880 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostGroupsOperationsExtensions.cs @@ -0,0 +1,356 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DedicatedHostGroupsOperations. + /// + public static partial class DedicatedHostGroupsOperationsExtensions + { + /// + /// 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) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + public static DedicatedHostGroup CreateOrUpdate(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, hostGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// 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) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + public static DedicatedHostGroup Update(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, hostGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + public static void Delete(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName) + { + operations.DeleteAsync(resourceGroupName, hostGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated hosts under the + /// dedicated host group. 'UserData' is not supported for dedicated host group. + /// Possible values include: 'instanceView', 'userData' + /// + public static DedicatedHostGroup Get(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, hostGroupName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated hosts under the + /// dedicated host group. 'UserData' is not supported for dedicated host group. + /// Possible values include: 'instanceView', 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, hostGroupName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDedicatedHostGroupsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDedicatedHostGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IDedicatedHostGroupsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IDedicatedHostGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDedicatedHostGroupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the specified resource group. Use + /// the nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDedicatedHostGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IDedicatedHostGroupsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated host + /// groups. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IDedicatedHostGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperations.cs new file mode 100644 index 000000000000..f3eaeda39803 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperations.cs @@ -0,0 +1,1794 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DedicatedHostsOperations operations. + /// + internal partial class DedicatedHostsOperations : IServiceOperations, IDedicatedHostsOperations + { + /// + /// Initializes a new instance of the DedicatedHostsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DedicatedHostsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated host. 'UserData' is + /// not supported for dedicated host. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByHostGroupWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByHostGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all available dedicated host sizes to which the specified dedicated + /// host can be resized. NOTE: The dedicated host sizes provided can be used to + /// only scale up the existing dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostGroupName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(hostGroupName, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "hostGroupName", "^[-\\w\\._]+$"); + } + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (hostName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(hostName, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "hostName", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAvailableSizes", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hostGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostGroupName"); + } + if (hostName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hostName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("hostGroupName", hostGroupName); + tracingParameters.Add("hostName", hostName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hostGroupName}", System.Uri.EscapeDataString(hostGroupName)); + _url = _url.Replace("{hostName}", System.Uri.EscapeDataString(hostName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByHostGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByHostGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperationsExtensions.cs new file mode 100644 index 000000000000..2dc2f7b1dfac --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DedicatedHostsOperationsExtensions.cs @@ -0,0 +1,617 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DedicatedHostsOperations. + /// + public static partial class DedicatedHostsOperationsExtensions + { + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + public static DedicatedHost CreateOrUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + public static DedicatedHost Update(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void Delete(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.DeleteAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated host. 'UserData' is + /// not supported for dedicated host. Possible values include: 'instanceView', + /// 'userData' + /// + public static DedicatedHost Get(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, hostGroupName, hostName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the list of instance views of the dedicated host. 'UserData' is + /// not supported for dedicated host. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + public static IPage ListByHostGroup(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName) + { + return operations.ListByHostGroupAsync(resourceGroupName, hostGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHostGroupAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHostGroupWithHttpMessagesAsync(resourceGroupName, hostGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void Restart(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.RestartAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all available dedicated host sizes to which the specified dedicated + /// host can be resized. NOTE: The dedicated host sizes provided can be used to + /// only scale up the existing dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static IEnumerable ListAvailableSizes(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + return operations.ListAvailableSizesAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Lists all available dedicated host sizes to which the specified dedicated + /// host can be resized. NOTE: The dedicated host sizes provided can be used to + /// only scale up the existing dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAvailableSizesAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAvailableSizesWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + public static DedicatedHost BeginCreateOrUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + public static DedicatedHost BeginUpdate(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, hostGroupName, hostName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a dedicated host . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void BeginDelete(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.BeginDeleteAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Delete a dedicated host. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + public static void BeginRestart(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName) + { + operations.BeginRestartAsync(resourceGroupName, hostGroupName, hostName).GetAwaiter().GetResult(); + } + + /// + /// Restart the dedicated host. The operation will complete successfully once + /// the dedicated host has restarted and is running. To determine the health of + /// VMs deployed on the dedicated host after the restart check the Resource + /// Health Center in the Azure Portal. Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IDedicatedHostsOperations operations, string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, hostGroupName, hostName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByHostGroupNext(this IDedicatedHostsOperations operations, string nextPageLink) + { + return operations.ListByHostGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the dedicated hosts in the specified dedicated host group. Use + /// the nextLink property in the response to get the next page of dedicated + /// hosts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHostGroupNextAsync(this IDedicatedHostsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHostGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperations.cs new file mode 100644 index 000000000000..08f481880f17 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperations.cs @@ -0,0 +1,2944 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskAccessesOperations operations. + /// + internal partial class DiskAccessesOperations : IServiceOperations, IDiskAccessesOperations + { + /// + /// Initializes a new instance of the DiskAccessesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskAccessesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetPrivateLinkResourcesWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPrivateLinkResources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a private endpoint connection under a disk access + /// resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAPrivateEndpointConnection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListPrivateEndpointConnectionsWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPrivateEndpointConnections", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + if (diskAccess == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccess"); + } + if (diskAccess != null) + { + diskAccess.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskAccess", diskAccess); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diskAccess != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskAccess, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2023-04-02"; + DiskAccessUpdate diskAccess = new DiskAccessUpdate(); + if (tags != null) + { + diskAccess.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskAccess", diskAccess); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diskAccess != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskAccess, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnection == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnection"); + } + if (privateEndpointConnection != null) + { + privateEndpointConnection.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("privateEndpointConnection", privateEndpointConnection); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateAPrivateEndpointConnection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(privateEndpointConnection != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateEndpointConnection, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskAccessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskAccessName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskAccessName", diskAccessName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAPrivateEndpointConnection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskAccessName}", System.Uri.EscapeDataString(diskAccessName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListPrivateEndpointConnectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPrivateEndpointConnectionsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperationsExtensions.cs new file mode 100644 index 000000000000..6dc3053e26ef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskAccessesOperationsExtensions.cs @@ -0,0 +1,903 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskAccessesOperations. + /// + public static partial class DiskAccessesOperationsExtensions + { + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + public static DiskAccess CreateOrUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + public static DiskAccess Update(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, diskAccessName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static DiskAccess Get(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + return operations.GetAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static void Delete(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + operations.DeleteAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDiskAccessesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskAccessesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDiskAccessesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiskAccessesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static PrivateLinkResourceListResult GetPrivateLinkResources(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + return operations.GetPrivateLinkResourcesAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetPrivateLinkResourcesAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPrivateLinkResourcesWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + public static PrivateEndpointConnection UpdateAPrivateEndpointConnection(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.UpdateAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAPrivateEndpointConnectionAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a private endpoint connection under a disk access + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + public static PrivateEndpointConnection GetAPrivateEndpointConnection(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName) + { + return operations.GetAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a private endpoint connection under a disk access + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task GetAPrivateEndpointConnectionAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + public static void DeleteAPrivateEndpointConnection(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName) + { + operations.DeleteAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAPrivateEndpointConnectionAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static IPage ListPrivateEndpointConnections(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + return operations.ListPrivateEndpointConnectionsAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPrivateEndpointConnectionsAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPrivateEndpointConnectionsWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + public static DiskAccess BeginCreateOrUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk access resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk access object supplied in the body of the Put disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, DiskAccess diskAccess, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, diskAccess, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + public static DiskAccess BeginUpdate(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, diskAccessName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskAccessName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static void BeginDelete(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName) + { + operations.BeginDeleteAsync(resourceGroupName, diskAccessName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskAccessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + public static PrivateEndpointConnection BeginUpdateAPrivateEndpointConnection(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.BeginUpdateAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection under disk access resource, + /// this can't be used to create a new private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put private + /// endpoint connection operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAPrivateEndpointConnectionAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + public static void BeginDeleteAPrivateEndpointConnection(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName) + { + operations.BeginDeleteAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAPrivateEndpointConnectionAsync(this IDiskAccessesOperations operations, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteAPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskAccessesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskAccessesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiskAccessesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDiskAccessesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListPrivateEndpointConnectionsNext(this IDiskAccessesOperations operations, string nextPageLink) + { + return operations.ListPrivateEndpointConnectionsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List information about private endpoint connections under a disk access + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPrivateEndpointConnectionsNextAsync(this IDiskAccessesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPrivateEndpointConnectionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperations.cs new file mode 100644 index 000000000000..cdb644b95b07 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperations.cs @@ -0,0 +1,2051 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskEncryptionSetsOperations operations. + /// + internal partial class DiskEncryptionSetsOperations : IServiceOperations, IDiskEncryptionSetsOperations + { + /// + /// Initializes a new instance of the DiskEncryptionSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskEncryptionSetsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAssociatedResourcesWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAssociatedResources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + if (diskEncryptionSet != null) + { + diskEncryptionSet.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAssociatedResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAssociatedResourcesNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperationsExtensions.cs new file mode 100644 index 000000000000..59436941d6f8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskEncryptionSetsOperationsExtensions.cs @@ -0,0 +1,583 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskEncryptionSetsOperations. + /// + public static partial class DiskEncryptionSetsOperationsExtensions + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet CreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet Update(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.UpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static DiskEncryptionSet Get(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + return operations.GetAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static void Delete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.DeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDiskEncryptionSetsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDiskEncryptionSetsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiskEncryptionSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static IPage ListAssociatedResources(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + return operations.ListAssociatedResourcesAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAssociatedResourcesAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAssociatedResourcesWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet BeginCreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet BeginUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.BeginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + public static void BeginDelete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.BeginDeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAssociatedResourcesNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListAssociatedResourcesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all resources that are encrypted with this disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAssociatedResourcesNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAssociatedResourcesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperations.cs new file mode 100644 index 000000000000..4f43b133b870 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperations.cs @@ -0,0 +1,1128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskRestorePointOperations operations. + /// + internal partial class DiskRestorePointOperations : IServiceOperations, IDiskRestorePointOperations + { + /// + /// Initializes a new instance of the DiskRestorePointOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskRestorePointOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Get disk restorePoint resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + if (diskRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskRestorePointName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("diskRestorePointName", diskRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + _url = _url.Replace("{diskRestorePointName}", System.Uri.EscapeDataString(diskRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByRestorePointWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByRestorePoint", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + if (diskRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskRestorePointName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("diskRestorePointName", diskRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + _url = _url.Replace("{diskRestorePointName}", System.Uri.EscapeDataString(diskRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (vmRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmRestorePointName"); + } + if (diskRestorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskRestorePointName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("vmRestorePointName", vmRestorePointName); + tracingParameters.Add("diskRestorePointName", diskRestorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{vmRestorePointName}", System.Uri.EscapeDataString(vmRestorePointName)); + _url = _url.Replace("{diskRestorePointName}", System.Uri.EscapeDataString(diskRestorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByRestorePointNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByRestorePointNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperationsExtensions.cs new file mode 100644 index 000000000000..33a720abc7ad --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DiskRestorePointOperationsExtensions.cs @@ -0,0 +1,383 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskRestorePointOperations. + /// + public static partial class DiskRestorePointOperationsExtensions + { + /// + /// Get disk restorePoint resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + public static DiskRestorePoint Get(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName) + { + return operations.GetAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Get disk restorePoint resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + public static IPage ListByRestorePoint(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName) + { + return operations.ListByRestorePointAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByRestorePointAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByRestorePointWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri GrantAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + public static void RevokeAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName) + { + operations.RevokeAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri BeginGrantAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + public static void BeginRevokeAccess(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore point + /// belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this IDiskRestorePointOperations operations, string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByRestorePointNext(this IDiskRestorePointOperations operations, string nextPageLink) + { + return operations.ListByRestorePointNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByRestorePointNextAsync(this IDiskRestorePointOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByRestorePointNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DisksOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/DisksOperations.cs new file mode 100644 index 000000000000..ae997dfb959d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DisksOperations.cs @@ -0,0 +1,2110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DisksOperations operations. + /// + internal partial class DisksOperations : IServiceOperations, IDisksOperations + { + /// + /// Initializes a new instance of the DisksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DisksOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + if (disk != null) + { + disk.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("disk", disk); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(disk != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(disk, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (disk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "disk"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("disk", disk); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(disk != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(disk, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/DisksOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/DisksOperationsExtensions.cs new file mode 100644 index 000000000000..690e7af288f3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/DisksOperationsExtensions.cs @@ -0,0 +1,663 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DisksOperations. + /// + public static partial class DisksOperationsExtensions + { + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + public static Disk CreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + public static Disk Update(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk) + { + return operations.UpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + public static Disk Get(this IDisksOperations operations, string resourceGroupName, string diskName) + { + return operations.GetAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + public static void Delete(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.DeleteAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDisksOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDisksOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDisksOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDisksOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri GrantAccess(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, diskName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + public static void RevokeAccess(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.RevokeAccessAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + public static Disk BeginCreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + public static Disk BeginUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk) + { + return operations.BeginUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, DiskUpdate disk, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + public static void BeginDelete(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.BeginDeleteAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + public static AccessUri BeginGrantAccess(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, diskName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get disk access operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, diskName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + public static void BeginRevokeAccess(this IDisksOperations operations, string resourceGroupName, string diskName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, diskName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't be + /// changed after the disk is created. Supported characters for the name are + /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this IDisksOperations operations, string resourceGroupName, string diskName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, diskName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDisksOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDisksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDisksOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDisksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperations.cs new file mode 100644 index 000000000000..b0d8c2d6a189 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperations.cs @@ -0,0 +1,1682 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleriesOperations operations. + /// + internal partial class GalleriesOperations : IServiceOperations, IGalleriesOperations + { + /// + /// Initializes a new instance of the GalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleriesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// + /// + /// The expand query option to apply on the operation. Possible values include: + /// 'SharingProfile/Groups' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("select", select); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List galleries under a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (gallery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gallery"); + } + if (gallery != null) + { + gallery.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("gallery", gallery); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(gallery != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(gallery, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (gallery == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gallery"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("gallery", gallery); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(gallery != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(gallery, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List galleries under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List galleries under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperationsExtensions.cs new file mode 100644 index 000000000000..f6a01ab0e57c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleriesOperationsExtensions.cs @@ -0,0 +1,485 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleriesOperations. + /// + public static partial class GalleriesOperationsExtensions + { + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + public static Gallery CreateOrUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + public static Gallery Update(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery) + { + return operations.UpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// + /// + /// The expand query option to apply on the operation. Possible values include: + /// 'SharingProfile/Groups' + /// + public static Gallery Get(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select = default(string), string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, galleryName, select, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The select expression to apply on the operation. Possible values include: + /// 'Permissions' + /// + /// + /// The expand query option to apply on the operation. Possible values include: + /// 'SharingProfile/Groups' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, string select = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, select, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + public static void Delete(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + { + operations.DeleteAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IGalleriesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IGalleriesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IGalleriesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IGalleriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + public static Gallery BeginCreateOrUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, Gallery gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + public static Gallery BeginUpdate(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, gallery).GetAwaiter().GetResult(); + } + + /// + /// Update a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are alphabets + /// and numbers with dots and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, GalleryUpdate gallery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, gallery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + public static void BeginDelete(this IGalleriesOperations operations, string resourceGroupName, string galleryName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleriesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IGalleriesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IGalleriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List galleries under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperations.cs new file mode 100644 index 000000000000..c27cb3bed150 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperations.cs @@ -0,0 +1,1454 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryApplicationVersionsOperations operations. + /// + internal partial class GalleryApplicationVersionsOperations : IServiceOperations, IGalleryApplicationVersionsOperations + { + /// + /// Initializes a new instance of the GalleryApplicationVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryApplicationVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application Versions are to be listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryApplicationWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryApplication", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + if (galleryApplicationVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersion"); + } + if (galleryApplicationVersion != null) + { + galleryApplicationVersion.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplicationVersion", galleryApplicationVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryApplicationVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplicationVersion, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + if (galleryApplicationVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersion"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplicationVersion", galleryApplicationVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryApplicationVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplicationVersion, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplicationVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("galleryApplicationVersionName", galleryApplicationVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + _url = _url.Replace("{galleryApplicationVersionName}", System.Uri.EscapeDataString(galleryApplicationVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryApplicationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryApplicationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..cc5e317d0b6c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationVersionsOperationsExtensions.cs @@ -0,0 +1,555 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleryApplicationVersionsOperations. + /// + public static partial class GalleryApplicationVersionsOperationsExtensions + { + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + public static GalleryApplicationVersion CreateOrUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + public static GalleryApplicationVersion Update(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + public static GalleryApplicationVersion Get(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + public static void Delete(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application Versions are to be listed. + /// + public static IPage ListByGalleryApplication(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + return operations.ListByGalleryApplicationAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition from + /// which the Application Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryApplicationAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryApplicationWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + public static GalleryApplicationVersion BeginCreateOrUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application Version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + public static GalleryApplicationVersion BeginUpdate(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + public static void BeginDelete(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application Version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the Application + /// Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryApplicationVersionsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryApplicationNext(this IGalleryApplicationVersionsOperations operations, string nextPageLink) + { + return operations.ListByGalleryApplicationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Versions in a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryApplicationNextAsync(this IGalleryApplicationVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryApplicationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperations.cs new file mode 100644 index 000000000000..0b417c20c00f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperations.cs @@ -0,0 +1,1377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryApplicationsOperations operations. + /// + internal partial class GalleryApplicationsOperations : IServiceOperations, IGalleryApplicationsOperations + { + /// + /// Initializes a new instance of the GalleryApplicationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryApplicationsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGallery", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplication == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplication"); + } + if (galleryApplication != null) + { + galleryApplication.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplication", galleryApplication); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryApplication != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplication, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + if (galleryApplication == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplication"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryApplication", galleryApplication); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryApplication != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryApplication, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryApplicationName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryApplicationName", galleryApplicationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryApplicationName}", System.Uri.EscapeDataString(galleryApplicationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperationsExtensions.cs new file mode 100644 index 000000000000..c921093fd306 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryApplicationsOperationsExtensions.cs @@ -0,0 +1,471 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleryApplicationsOperations. + /// + public static partial class GalleryApplicationsOperationsExtensions + { + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + public static GalleryApplication CreateOrUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + public static GalleryApplication Update(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + public static GalleryApplication Get(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the Application + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + public static void Delete(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + public static IPage ListByGallery(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName) + { + return operations.ListByGalleryAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + public static GalleryApplication BeginCreateOrUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + public static GalleryApplication BeginUpdate(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery Application Definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + public static void BeginDelete(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryApplicationsOperations operations, string resourceGroupName, string galleryName, string galleryApplicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryApplicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryNext(this IGalleryApplicationsOperations operations, string nextPageLink) + { + return operations.ListByGalleryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryNextAsync(this IGalleryApplicationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..3774e9c0f557 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperations.cs @@ -0,0 +1,1446 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryImageVersionsOperations operations. + /// + internal partial class GalleryImageVersionsOperations : IServiceOperations, IGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the GalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryImageVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryImageWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryImage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + if (galleryImageVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersion"); + } + if (galleryImageVersion != null) + { + galleryImageVersion.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImageVersion", galleryImageVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryImageVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImageVersion, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + if (galleryImageVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersion"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImageVersion", galleryImageVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryImageVersion != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImageVersion, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryImageNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryImageNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..f77ed912503e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryImageVersionsOperationsExtensions.cs @@ -0,0 +1,539 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleryImageVersionsOperations. + /// + public static partial class GalleryImageVersionsOperationsExtensions + { + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + public static GalleryImageVersion CreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + public static GalleryImageVersion Update(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + public static GalleryImageVersion Get(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values include: + /// 'ReplicationStatus' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + public static void Delete(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + public static IPage ListByGalleryImage(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName) + { + return operations.ListByGalleryImageAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryImageAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryImageWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + public static GalleryImageVersion BeginCreateOrUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be created. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + public static GalleryImageVersion BeginUpdate(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version is to + /// be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + public static void BeginDelete(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryImageVersionsOperations operations, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryImageNext(this IGalleryImageVersionsOperations operations, string nextPageLink) + { + return operations.ListByGalleryImageNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryImageNextAsync(this IGalleryImageVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryImageNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperations.cs new file mode 100644 index 000000000000..c26522ef20b0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperations.cs @@ -0,0 +1,1377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryImagesOperations operations. + /// + internal partial class GalleryImagesOperations : IServiceOperations, IGalleryImagesOperations + { + /// + /// Initializes a new instance of the GalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GalleryImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions are to be + /// listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGallery", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + } + if (galleryImage != null) + { + galleryImage.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImage", galleryImage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImage"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryImage", galleryImage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(galleryImage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(galleryImage, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByGalleryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..578c096bffa6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GalleryImagesOperationsExtensions.cs @@ -0,0 +1,471 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GalleryImagesOperations. + /// + public static partial class GalleryImagesOperationsExtensions + { + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + public static GalleryImage CreateOrUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage) + { + return operations.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + public static GalleryImage Update(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage) + { + return operations.UpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + public static GalleryImage Get(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) + { + return operations.GetAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image Definitions are + /// to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + public static void Delete(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) + { + operations.DeleteAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions are to be + /// listed. + /// + public static IPage ListByGallery(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName) + { + return operations.ListByGalleryAsync(resourceGroupName, galleryName).GetAwaiter().GetResult(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions are to be + /// listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryWithHttpMessagesAsync(resourceGroupName, galleryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + public static GalleryImage BeginCreateOrUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Create or update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// created. + /// + /// + /// The name of the gallery image definition to be created or updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + public static GalleryImage BeginUpdate(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).GetAwaiter().GetResult(); + } + + /// + /// Update a gallery image definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods allowed + /// in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + public static void BeginDelete(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName) + { + operations.BeginDeleteAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Delete a gallery image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition is to be + /// deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGalleryImagesOperations operations, string resourceGroupName, string galleryName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByGalleryNext(this IGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListByGalleryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByGalleryNextAsync(this IGalleryImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByGalleryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperations.cs new file mode 100644 index 000000000000..06b157a1bf5d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperations.cs @@ -0,0 +1,309 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GallerySharingProfileOperations operations. + /// + internal partial class GallerySharingProfileOperations : IServiceOperations, IGallerySharingProfileOperations + { + /// + /// Initializes a new instance of the GallerySharingProfileOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GallerySharingProfileOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (galleryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryName"); + } + if (sharingUpdate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sharingUpdate"); + } + if (sharingUpdate != null) + { + sharingUpdate.Validate(); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("galleryName", galleryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("sharingUpdate", sharingUpdate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{galleryName}", System.Uri.EscapeDataString(galleryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sharingUpdate != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sharingUpdate, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperationsExtensions.cs new file mode 100644 index 000000000000..9ab1747dd236 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/GallerySharingProfileOperationsExtensions.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GallerySharingProfileOperations. + /// + public static partial class GallerySharingProfileOperationsExtensions + { + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + public static SharingUpdate Update(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate) + { + return operations.UpdateAsync(resourceGroupName, galleryName, sharingUpdate).GetAwaiter().GetResult(); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + public static SharingUpdate BeginUpdate(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate) + { + return operations.BeginUpdateAsync(resourceGroupName, galleryName, sharingUpdate).GetAwaiter().GetResult(); + } + + /// + /// Update sharing profile of a gallery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IGallerySharingProfileOperations operations, string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, galleryName, sharingUpdate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IAvailabilitySetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IAvailabilitySetsOperations.cs new file mode 100644 index 000000000000..e24829ecadaf --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IAvailabilitySetsOperations.cs @@ -0,0 +1,245 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailabilitySetsOperations operations. + /// + public partial interface IAvailabilitySetsOperations + { + /// + /// Create or update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Create Availability Set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// Parameters supplied to the Update Availability Set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, AvailabilitySetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about an availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The expand expression to apply to the operation. Allowed values are + /// 'instanceView'. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available virtual machine sizes that can be used to + /// create a new virtual machine in an existing availability set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the availability set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all availability sets in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationGroupsOperations.cs new file mode 100644 index 000000000000..ef1dea4916f4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationGroupsOperations.cs @@ -0,0 +1,255 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CapacityReservationGroupsOperations operations. + /// + public partial interface ICapacityReservationGroupsOperations + { + /// + /// The operation to create or update a capacity reservation group. + /// When updating a capacity reservation group, only tags may be + /// modified. Please refer to https://aka.ms/CapacityReservation for + /// more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Parameters supplied to the Create capacity reservation Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, CapacityReservationGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a capacity reservation group. When updating + /// a capacity reservation group, only tags may be modified. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a capacity reservation group. This + /// operation is allowed only if all the associated resources are + /// disassociated from the reservation group and all capacity + /// reservations under the reservation group have also been deleted. + /// Please refer to https://aka.ms/CapacityReservation for more + /// details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation that retrieves information about a capacity + /// reservation group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// will retrieve the list of instance views of the capacity + /// reservations under the capacity reservation group which is a + /// snapshot of the runtime properties of a capacity reservation that + /// is managed by the platform and can change outside of control plane + /// operations. Possible values include: 'instanceView' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservation groups in the specified + /// resource group. Use the nextLink property in the response to get + /// the next page of capacity reservation groups. + /// + /// + /// The name of the resource group. + /// + /// + /// The expand expression to apply on the operation. Based on the + /// expand param(s) specified we return Virtual Machine or ScaleSet VM + /// Instance or both resource Ids which are associated to capacity + /// reservation group in the response. Possible values include: + /// 'virtualMachineScaleSetVMs/$ref', 'virtualMachines/$ref' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservation groups in the subscription. + /// Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The expand expression to apply on the operation. Based on the + /// expand param(s) specified we return Virtual Machine or ScaleSet VM + /// Instance or both resource Ids which are associated to capacity + /// reservation group in the response. Possible values include: + /// 'virtualMachineScaleSetVMs/$ref', 'virtualMachines/$ref' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservation groups in the specified + /// resource group. Use the nextLink property in the response to get + /// the next page of capacity reservation groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservation groups in the subscription. + /// Use the nextLink property in the response to get the next page of + /// capacity reservation groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationsOperations.cs new file mode 100644 index 000000000000..b8f015685f34 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICapacityReservationsOperations.cs @@ -0,0 +1,300 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CapacityReservationsOperations operations. + /// + public partial interface ICapacityReservationsOperations + { + /// + /// The operation to create or update a capacity reservation. Please + /// note some properties can be set only during capacity reservation + /// creation. Please refer to https://aka.ms/CapacityReservation for + /// more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a capacity reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a capacity reservation. This operation is + /// allowed only when all the associated resources are disassociated + /// from the capacity reservation. Please refer to + /// https://aka.ms/CapacityReservation for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation that retrieves information about the capacity + /// reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// retrieves a snapshot of the runtime properties of the capacity + /// reservation that is managed by the platform and can change outside + /// of control plane operations. Possible values include: + /// 'instanceView' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get + /// the next page of capacity reservations. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCapacityReservationGroupWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a capacity reservation. Please + /// note some properties can be set only during capacity reservation + /// creation. Please refer to https://aka.ms/CapacityReservation for + /// more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Create capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a capacity reservation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// Parameters supplied to the Update capacity reservation operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, CapacityReservationUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a capacity reservation. This operation is + /// allowed only when all the associated resources are disassociated + /// from the capacity reservation. Please refer to + /// https://aka.ms/CapacityReservation for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the capacity reservation group. + /// + /// + /// The name of the capacity reservation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string capacityReservationGroupName, string capacityReservationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the capacity reservations in the specified capacity + /// reservation group. Use the nextLink property in the response to get + /// the next page of capacity reservations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCapacityReservationGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceOperatingSystemsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceOperatingSystemsOperations.cs new file mode 100644 index 000000000000..26e60af5d844 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceOperatingSystemsOperations.cs @@ -0,0 +1,185 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceOperatingSystemsOperations operations. + /// + public partial interface ICloudServiceOperatingSystemsOperations + { + /// + /// Gets properties of a guest operating system version that can be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. + /// + /// + /// Name of the location that the OS version pertains to. + /// + /// + /// Name of the OS version. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOSVersionWithHttpMessagesAsync(string location, string osVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. Use nextLink property in the response to get the next page + /// of OS versions. Do this till nextLink is null to fetch all the OS + /// versions. + /// + /// + /// Name of the location that the OS versions pertain to. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOSVersionsWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a guest operating system family that can be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. + /// + /// + /// Name of the location that the OS family pertains to. + /// + /// + /// Name of the OS family. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOSFamilyWithHttpMessagesAsync(string location, string osFamilyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. Use nextLink property in the response to get the next page + /// of OS Families. Do this till nextLink is null to fetch all the OS + /// Families. + /// + /// + /// Name of the location that the OS families pertain to. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOSFamiliesWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all guest operating system versions available to be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. Use nextLink property in the response to get the next page + /// of OS versions. Do this till nextLink is null to fetch all the OS + /// versions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOSVersionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all guest operating system families available to be + /// specified in the XML service configuration (.cscfg) for a cloud + /// service. Use nextLink property in the response to get the next page + /// of OS Families. Do this till nextLink is null to fetch all the OS + /// Families. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOSFamiliesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRoleInstancesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRoleInstancesOperations.cs new file mode 100644 index 000000000000..73d992e99e57 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRoleInstancesOperations.cs @@ -0,0 +1,388 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRoleInstancesOperations operations. + /// + public partial interface ICloudServiceRoleInstancesOperations + { + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: + /// 'instanceView', 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about the run-time state of a role instance + /// in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetInstanceViewWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of all role instances in a cloud service. Use + /// nextLink property in the response to get the next page of role + /// instances. Do this till nextLink is null to fetch all the role + /// instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The expand expression to apply to the operation. 'UserData' is not + /// supported for cloud services. Possible values include: + /// 'instanceView', 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reboot Role Instance asynchronous operation requests a reboot + /// of a role instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reimage Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles and + /// initializes the storage resources that are used by them. If you do + /// not want to initialize storage resources, you can use Reimage Role + /// Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a remote desktop file for a role instance in a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetRemoteDesktopFileWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a role instance from a cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reboot Role Instance asynchronous operation requests a reboot + /// of a role instance in the cloud service. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Reimage Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The Rebuild Role Instance asynchronous operation reinstalls the + /// operating system on instances of web roles or worker roles and + /// initializes the storage resources that are used by them. If you do + /// not want to initialize storage resources, you can use Reimage Role + /// Instance. + /// + /// + /// Name of the role instance. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRebuildWithHttpMessagesAsync(string roleInstanceName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of all role instances in a cloud service. Use + /// nextLink property in the response to get the next page of role + /// instances. Do this till nextLink is null to fetch all the role + /// instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRolesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRolesOperations.cs new file mode 100644 index 000000000000..fdd36f0ef63f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICloudServiceRolesOperations.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServiceRolesOperations operations. + /// + public partial interface ICloudServiceRolesOperations + { + /// + /// Gets a role from a cloud service. + /// + /// + /// Name of the role. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string roleName, string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all roles in a cloud service. Use nextLink property + /// in the response to get the next page of roles. Do this till + /// nextLink is null to fetch all the roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all roles in a cloud service. Use nextLink property + /// in the response to get the next page of roles. Do this till + /// nextLink is null to fetch all the roles. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesOperations.cs new file mode 100644 index 000000000000..837bdd793337 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesOperations.cs @@ -0,0 +1,638 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesOperations operations. + /// + public partial interface ICloudServicesOperations + { + /// + /// Create or update a cloud service. Please note some properties can + /// be set only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Display information about a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services in the subscription, regardless + /// of the associated resource group. Use nextLink property in the + /// response to get the next page of Cloud Services. Do this till + /// nextLink is null to fetch all the Cloud Services. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services under a resource group. Use + /// nextLink property in the response to get the next page of Cloud + /// Services. Do this till nextLink is null to fetch all the Cloud + /// Services. + /// + /// + /// Name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off the cloud service. Note that resources are still attached + /// and you are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimage asynchronous operation reinstalls the operating system on + /// instances of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Rebuild Role Instances reinstalls the operating system on instances + /// of web roles or worker roles and initializes the storage resources + /// that are used by them. If you do not want to initialize storage + /// resources, you can use Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a cloud service. Please note some properties can + /// be set only during cloud service creation. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The cloud service object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, CloudService parameters = default(CloudService), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off the cloud service. Note that resources are still attached + /// and you are getting charged for the resources. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimage asynchronous operation reinstalls the operating system on + /// instances of web roles or worker roles. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Rebuild Role Instances reinstalls the operating system on instances + /// of web roles or worker roles and initializes the storage resources + /// that are used by them. If you do not want to initialize storage + /// resources, you can use Reimage Role Instances. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRebuildWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes role instances in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// List of cloud service role instance names. Value of '*' will + /// signify all role instances of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, IList roleInstancesProperty, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services in the subscription, regardless + /// of the associated resource group. Use nextLink property in the + /// response to get the next page of Cloud Services. Do this till + /// nextLink is null to fetch all the Cloud Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all cloud services under a resource group. Use + /// nextLink property in the response to get the next page of Cloud + /// Services. Do this till nextLink is null to fetch all the Cloud + /// Services. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesUpdateDomainOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesUpdateDomainOperations.cs new file mode 100644 index 000000000000..cdac93b47a19 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICloudServicesUpdateDomainOperations.cs @@ -0,0 +1,160 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CloudServicesUpdateDomainOperations operations. + /// + public partial interface ICloudServicesUpdateDomainOperations + { + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task WalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified update domain of a cloud service. Use nextLink + /// property in the response to get the next page of update domains. Do + /// this till nextLink is null to fetch all the update domains. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListUpdateDomainsWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the role instances in the specified update domain. + /// + /// + /// Name of the resource group. + /// + /// + /// Name of the cloud service. + /// + /// + /// Specifies an integer value that identifies the update domain. + /// Update domains are identified with a zero-based index: the first + /// update domain has an ID of 0, the second has an ID of 1, and so on. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginWalkUpdateDomainWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, int updateDomain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all update domains in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListUpdateDomainsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleriesOperations.cs new file mode 100644 index 000000000000..39f3cbf24f5a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleriesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleriesOperations operations. + /// + public partial interface ICommunityGalleriesOperations + { + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..3c668bd25e85 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImageVersionsOperations.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImageVersionsOperations operations. + /// + public partial interface ICommunityGalleryImageVersionsOperations + { + /// + /// Get a community gallery image version. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The name of the community gallery image version. Needs to follow + /// semantic version name pattern: The allowed characters are digit and + /// period. Digits must be within the range of a 32-bit integer. + /// Format: <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List community gallery image versions inside an image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List community gallery image versions inside an image. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImagesOperations.cs new file mode 100644 index 000000000000..38391de5f3d7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ICommunityGalleryImagesOperations.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommunityGalleryImagesOperations operations. + /// + public partial interface ICommunityGalleryImagesOperations + { + /// + /// Get a community gallery image. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The name of the community gallery image definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publicGalleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List community gallery images inside a gallery. + /// + /// + /// Resource location. + /// + /// + /// The public name of the community gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string publicGalleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List community gallery images inside a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IComputeManagementClient.cs b/src/Compute/Compute.Management.Sdk/Generated/IComputeManagementClient.cs new file mode 100644 index 000000000000..dfd4c6b8f49e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IComputeManagementClient.cs @@ -0,0 +1,314 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface IComputeManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Subscription credentials which uniquely identify Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every + /// service call. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IUsageOperations. + /// + IUsageOperations Usage { get; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + IVirtualMachineSizesOperations VirtualMachineSizes { get; } + + /// + /// Gets the IVirtualMachineScaleSetsOperations. + /// + IVirtualMachineScaleSetsOperations VirtualMachineScaleSets { get; } + + /// + /// Gets the IVirtualMachineScaleSetExtensionsOperations. + /// + IVirtualMachineScaleSetExtensionsOperations VirtualMachineScaleSetExtensions { get; } + + /// + /// Gets the IVirtualMachineScaleSetRollingUpgradesOperations. + /// + IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; } + + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; } + + /// + /// Gets the IVirtualMachineScaleSetVMsOperations. + /// + IVirtualMachineScaleSetVMsOperations VirtualMachineScaleSetVMs { get; } + + /// + /// Gets the IVirtualMachineExtensionsOperations. + /// + IVirtualMachineExtensionsOperations VirtualMachineExtensions { get; } + + /// + /// Gets the IVirtualMachinesOperations. + /// + IVirtualMachinesOperations VirtualMachines { get; } + + /// + /// Gets the IVirtualMachineImagesOperations. + /// + IVirtualMachineImagesOperations VirtualMachineImages { get; } + + /// + /// Gets the IVirtualMachineImagesEdgeZoneOperations. + /// + IVirtualMachineImagesEdgeZoneOperations VirtualMachineImagesEdgeZone { get; } + + /// + /// Gets the IVirtualMachineExtensionImagesOperations. + /// + IVirtualMachineExtensionImagesOperations VirtualMachineExtensionImages { get; } + + /// + /// Gets the IAvailabilitySetsOperations. + /// + IAvailabilitySetsOperations AvailabilitySets { get; } + + /// + /// Gets the IProximityPlacementGroupsOperations. + /// + IProximityPlacementGroupsOperations ProximityPlacementGroups { get; } + + /// + /// Gets the IDedicatedHostGroupsOperations. + /// + IDedicatedHostGroupsOperations DedicatedHostGroups { get; } + + /// + /// Gets the IDedicatedHostsOperations. + /// + IDedicatedHostsOperations DedicatedHosts { get; } + + /// + /// Gets the ISshPublicKeysOperations. + /// + ISshPublicKeysOperations SshPublicKeys { get; } + + /// + /// Gets the IImagesOperations. + /// + IImagesOperations Images { get; } + + /// + /// Gets the IRestorePointCollectionsOperations. + /// + IRestorePointCollectionsOperations RestorePointCollections { get; } + + /// + /// Gets the IRestorePointsOperations. + /// + IRestorePointsOperations RestorePoints { get; } + + /// + /// Gets the ICapacityReservationGroupsOperations. + /// + ICapacityReservationGroupsOperations CapacityReservationGroups { get; } + + /// + /// Gets the ICapacityReservationsOperations. + /// + ICapacityReservationsOperations CapacityReservations { get; } + + /// + /// Gets the ILogAnalyticsOperations. + /// + ILogAnalyticsOperations LogAnalytics { get; } + + /// + /// Gets the IVirtualMachineRunCommandsOperations. + /// + IVirtualMachineRunCommandsOperations VirtualMachineRunCommands { get; } + + /// + /// Gets the IVirtualMachineScaleSetVMRunCommandsOperations. + /// + IVirtualMachineScaleSetVMRunCommandsOperations VirtualMachineScaleSetVMRunCommands { get; } + + /// + /// Gets the IDisksOperations. + /// + IDisksOperations Disks { get; } + + /// + /// Gets the IDiskAccessesOperations. + /// + IDiskAccessesOperations DiskAccesses { get; } + + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + IDiskEncryptionSetsOperations DiskEncryptionSets { get; } + + /// + /// Gets the IDiskRestorePointOperations. + /// + IDiskRestorePointOperations DiskRestorePoint { get; } + + /// + /// Gets the ISnapshotsOperations. + /// + ISnapshotsOperations Snapshots { get; } + + /// + /// Gets the IResourceSkusOperations. + /// + IResourceSkusOperations ResourceSkus { get; } + + /// + /// Gets the IGalleriesOperations. + /// + IGalleriesOperations Galleries { get; } + + /// + /// Gets the IGalleryImagesOperations. + /// + IGalleryImagesOperations GalleryImages { get; } + + /// + /// Gets the IGalleryImageVersionsOperations. + /// + IGalleryImageVersionsOperations GalleryImageVersions { get; } + + /// + /// Gets the IGalleryApplicationsOperations. + /// + IGalleryApplicationsOperations GalleryApplications { get; } + + /// + /// Gets the IGalleryApplicationVersionsOperations. + /// + IGalleryApplicationVersionsOperations GalleryApplicationVersions { get; } + + /// + /// Gets the IGallerySharingProfileOperations. + /// + IGallerySharingProfileOperations GallerySharingProfile { get; } + + /// + /// Gets the ISharedGalleriesOperations. + /// + ISharedGalleriesOperations SharedGalleries { get; } + + /// + /// Gets the ISharedGalleryImagesOperations. + /// + ISharedGalleryImagesOperations SharedGalleryImages { get; } + + /// + /// Gets the ISharedGalleryImageVersionsOperations. + /// + ISharedGalleryImageVersionsOperations SharedGalleryImageVersions { get; } + + /// + /// Gets the ICommunityGalleriesOperations. + /// + ICommunityGalleriesOperations CommunityGalleries { get; } + + /// + /// Gets the ICommunityGalleryImagesOperations. + /// + ICommunityGalleryImagesOperations CommunityGalleryImages { get; } + + /// + /// Gets the ICommunityGalleryImageVersionsOperations. + /// + ICommunityGalleryImageVersionsOperations CommunityGalleryImageVersions { get; } + + /// + /// Gets the ICloudServiceRoleInstancesOperations. + /// + ICloudServiceRoleInstancesOperations CloudServiceRoleInstances { get; } + + /// + /// Gets the ICloudServiceRolesOperations. + /// + ICloudServiceRolesOperations CloudServiceRoles { get; } + + /// + /// Gets the ICloudServicesOperations. + /// + ICloudServicesOperations CloudServices { get; } + + /// + /// Gets the ICloudServicesUpdateDomainOperations. + /// + ICloudServicesUpdateDomainOperations CloudServicesUpdateDomain { get; } + + /// + /// Gets the ICloudServiceOperatingSystemsOperations. + /// + ICloudServiceOperatingSystemsOperations CloudServiceOperatingSystems { get; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostGroupsOperations.cs new file mode 100644 index 000000000000..107ebc73dc6b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostGroupsOperations.cs @@ -0,0 +1,232 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DedicatedHostGroupsOperations operations. + /// + public partial interface IDedicatedHostGroupsOperations + { + /// + /// 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) + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Create Dedicated Host Group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// Parameters supplied to the Update Dedicated Host Group operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, DedicatedHostGroupUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// will retrieve the list of instance views of the dedicated hosts + /// under the dedicated host group. 'UserData' is not supported for + /// dedicated host group. Possible values include: 'instanceView', + /// 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the specified resource + /// group. Use the nextLink property in the response to get the next + /// page of dedicated host groups. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the specified resource + /// group. Use the nextLink property in the response to get the next + /// page of dedicated host groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated host groups in the subscription. Use the + /// nextLink property in the response to get the next page of dedicated + /// host groups. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostsOperations.cs new file mode 100644 index 000000000000..2afaf580760b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDedicatedHostsOperations.cs @@ -0,0 +1,378 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DedicatedHostsOperations operations. + /// + public partial interface IDedicatedHostsOperations + { + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// will retrieve the list of instance views of the dedicated host. + /// 'UserData' is not supported for dedicated host. Possible values + /// include: 'instanceView', 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated hosts in the specified dedicated host + /// group. Use the nextLink property in the response to get the next + /// page of dedicated hosts. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByHostGroupWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restart the dedicated host. The operation will complete + /// successfully once the dedicated host has restarted and is running. + /// To determine the health of VMs deployed on the dedicated host after + /// the restart check the Resource Health Center in the Azure Portal. + /// Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available dedicated host sizes to which the specified + /// dedicated host can be resized. NOTE: The dedicated host sizes + /// provided can be used to only scale up the existing dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Create Dedicated Host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a dedicated host . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host . + /// + /// + /// Parameters supplied to the Update Dedicated Host operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a dedicated host. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restart the dedicated host. The operation will complete + /// successfully once the dedicated host has restarted and is running. + /// To determine the health of VMs deployed on the dedicated host after + /// the restart check the Resource Health Center in the Azure Portal. + /// Please refer to + /// https://docs.microsoft.com/azure/service-health/resource-health-overview + /// for more details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the dedicated host group. + /// + /// + /// The name of the dedicated host. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string hostGroupName, string hostName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the dedicated hosts in the specified dedicated host + /// group. Use the nextLink property in the response to get the next + /// page of dedicated hosts. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByHostGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDiskAccessesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDiskAccessesOperations.cs new file mode 100644 index 000000000000..78ae20ec20e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDiskAccessesOperations.cs @@ -0,0 +1,558 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskAccessesOperations operations. + /// + public partial interface IDiskAccessesOperations + { + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk access object supplied in the body of the Put disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the private link resources possible under disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetPrivateLinkResourcesWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Approve or reject a private endpoint connection under disk access + /// resource, this can't be used to create a new private endpoint + /// connection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put + /// private endpoint connection operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a private endpoint connection under a disk + /// access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List information about private endpoint connections under a disk + /// access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListPrivateEndpointConnectionsWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk access resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk access object supplied in the body of the Put disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, DiskAccess diskAccess, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Approve or reject a private endpoint connection under disk access + /// resource, this can't be used to create a new private endpoint + /// connection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// private endpoint connection object supplied in the body of the Put + /// private endpoint connection operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection under a disk access resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk access resource that is being created. The + /// name can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteAPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string diskAccessName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List information about private endpoint connections under a disk + /// access resource + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListPrivateEndpointConnectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDiskEncryptionSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDiskEncryptionSetsOperations.cs new file mode 100644 index 000000000000..e165ca709ee6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDiskEncryptionSetsOperations.cs @@ -0,0 +1,370 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskEncryptionSetsOperations operations. + /// + public partial interface IDiskEncryptionSetsOperations + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all resources that are encrypted with this disk encryption + /// set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAssociatedResourcesWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all resources that are encrypted with this disk encryption + /// set. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAssociatedResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDiskRestorePointOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDiskRestorePointOperations.cs new file mode 100644 index 000000000000..57da1a147059 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDiskRestorePointOperations.cs @@ -0,0 +1,246 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskRestorePointOperations operations. + /// + public partial interface IDiskRestorePointOperations + { + /// + /// Get disk restorePoint resource + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByRestorePointWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a diskRestorePoint. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection that the disk restore + /// point belongs. + /// + /// + /// The name of the vm restore point that the disk disk restore point + /// belongs. + /// + /// + /// The name of the disk restore point created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string vmRestorePointName, string diskRestorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists diskRestorePoints under a vmRestorePoint. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByRestorePointNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IDisksOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IDisksOperations.cs new file mode 100644 index 000000000000..2aca4ce3f069 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IDisksOperations.cs @@ -0,0 +1,428 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DisksOperations operations. + /// + public partial interface IDisksOperations + { + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, Disk disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Disk object supplied in the body of the Patch disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskName, DiskUpdate disk, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get disk access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a disk. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed disk that is being created. The name can't + /// be changed after the disk is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string diskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disks under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGalleriesOperations.cs new file mode 100644 index 000000000000..59009c628f34 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGalleriesOperations.cs @@ -0,0 +1,311 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleriesOperations operations. + /// + public partial interface IGalleriesOperations + { + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// The select expression to apply on the operation. Possible values + /// include: 'Permissions' + /// + /// + /// The expand query option to apply on the operation. Possible values + /// include: 'SharingProfile/Groups' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the create or update Shared Image Gallery + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, Gallery gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. The allowed characters are + /// alphabets and numbers with dots and periods allowed in the middle. + /// The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update Shared Image Gallery operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Shared Image Gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List galleries under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationVersionsOperations.cs new file mode 100644 index 000000000000..60c629add8d3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationVersionsOperations.cs @@ -0,0 +1,342 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryApplicationVersionsOperations operations. + /// + public partial interface IGalleryApplicationVersionsOperations + { + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application + /// Version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values + /// include: 'ReplicationStatus' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Versions in a gallery Application + /// Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the Shared Application Gallery Application Definition + /// from which the Application Versions are to be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryApplicationWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be created. + /// + /// + /// The name of the gallery Application Version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery Application + /// Version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersion galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version is to be updated. + /// + /// + /// The name of the gallery Application Version to be updated. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery Application Version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, GalleryApplicationVersionUpdate galleryApplicationVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application Version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition resides. + /// + /// + /// The name of the gallery Application Definition in which the + /// Application Version resides. + /// + /// + /// The name of the gallery Application Version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Versions in a gallery Application + /// Definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryApplicationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationsOperations.cs new file mode 100644 index 000000000000..a606926a96de --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGalleryApplicationsOperations.cs @@ -0,0 +1,296 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryApplicationsOperations operations. + /// + public partial interface IGalleryApplicationsOperations + { + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or + /// updated. The allowed characters are alphabets and numbers with + /// dots, dashes, and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which the + /// Application Definitions are to be retrieved. + /// + /// + /// The name of the gallery Application Definition to be retrieved. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery from which Application + /// Definitions are to be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be created. + /// + /// + /// The name of the gallery Application Definition to be created or + /// updated. The allowed characters are alphabets and numbers with + /// dots, dashes, and periods allowed in the middle. The maximum length + /// is 80 characters. + /// + /// + /// Parameters supplied to the create or update gallery Application + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery Application Definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be updated. + /// + /// + /// The name of the gallery Application Definition to be updated. The + /// allowed characters are alphabets and numbers with dots, dashes, and + /// periods allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery Application operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery Application. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Application Gallery in which the Application + /// Definition is to be deleted. + /// + /// + /// The name of the gallery Application Definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery Application Definitions in a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..60387a8991fe --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGalleryImageVersionsOperations.cs @@ -0,0 +1,338 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryImageVersionsOperations operations. + /// + public partial interface IGalleryImageVersionsOperations + { + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// is to be created. + /// + /// + /// The name of the gallery image version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// is to be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be retrieved. + /// + /// + /// The expand expression to apply on the operation. Possible values + /// include: 'ReplicationStatus' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the Shared Image Gallery Image Definition from which + /// the Image Versions are to be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryImageWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// is to be created. + /// + /// + /// The name of the gallery image version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the create or update gallery image version + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersion galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// is to be updated. + /// + /// + /// The name of the gallery image version to be updated. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Parameters supplied to the update gallery image version operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, GalleryImageVersionUpdate galleryImageVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image version. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// resides. + /// + /// + /// The name of the gallery image definition in which the Image Version + /// resides. + /// + /// + /// The name of the gallery image version to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image versions in a gallery image definition. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryImageNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGalleryImagesOperations.cs new file mode 100644 index 000000000000..bfe8aaf91f55 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGalleryImagesOperations.cs @@ -0,0 +1,296 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GalleryImagesOperations operations. + /// + public partial interface IGalleryImagesOperations + { + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be created. + /// + /// + /// The name of the gallery image definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, + /// and periods allowed in the middle. The maximum length is 80 + /// characters. + /// + /// + /// Parameters supplied to the create or update gallery image + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which the Image + /// Definitions are to be retrieved. + /// + /// + /// The name of the gallery image definition to be retrieved. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery from which Image Definitions + /// are to be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be created. + /// + /// + /// The name of the gallery image definition to be created or updated. + /// The allowed characters are alphabets and numbers with dots, dashes, + /// and periods allowed in the middle. The maximum length is 80 + /// characters. + /// + /// + /// Parameters supplied to the create or update gallery image + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImage galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a gallery image definition. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be updated. + /// + /// + /// The name of the gallery image definition to be updated. The allowed + /// characters are alphabets and numbers with dots, dashes, and periods + /// allowed in the middle. The maximum length is 80 characters. + /// + /// + /// Parameters supplied to the update gallery image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, GalleryImageUpdate galleryImage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a gallery image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery in which the Image Definition + /// is to be deleted. + /// + /// + /// The name of the gallery image definition to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List gallery image definitions in a gallery. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IGallerySharingProfileOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IGallerySharingProfileOperations.cs new file mode 100644 index 000000000000..851857bc297a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IGallerySharingProfileOperations.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GallerySharingProfileOperations operations. + /// + public partial interface IGallerySharingProfileOperations + { + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update sharing profile of a gallery. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Shared Image Gallery. + /// + /// + /// Parameters supplied to the update gallery sharing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, SharingUpdate sharingUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IImagesOperations.cs new file mode 100644 index 000000000000..1c986b496988 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IImagesOperations.cs @@ -0,0 +1,304 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ImagesOperations operations. + /// + public partial interface IImagesOperations + { + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string imageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of images under a resource group. Use nextLink + /// property in the response to get the next page of Images. Do this + /// till nextLink is null to fetch all the Images. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of images under a resource group. Use nextLink + /// property in the response to get the next page of Images. Do this + /// till nextLink is null to fetch all the Images. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ILogAnalyticsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ILogAnalyticsOperations.cs new file mode 100644 index 000000000000..ab57fceb0ef6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ILogAnalyticsOperations.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LogAnalyticsOperations operations. + /// + public partial interface ILogAnalyticsOperations + { + /// + /// Export logs that show Api requests made by this subscription in the + /// given time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval + /// Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show total throttled Api requests for this + /// subscription in the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show Api requests made by this subscription in the + /// given time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval + /// Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export logs that show total throttled Api requests for this + /// subscription in the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..864deb05d8fc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IOperations.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Gets a list of compute operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IProximityPlacementGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IProximityPlacementGroupsOperations.cs new file mode 100644 index 000000000000..e32a4edba1db --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IProximityPlacementGroupsOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProximityPlacementGroupsOperations operations. + /// + public partial interface IProximityPlacementGroupsOperations + { + /// + /// Create or update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status + /// of all the resources in the proximity placement group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IResourceSkusOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IResourceSkusOperations.cs new file mode 100644 index 000000000000..5133041c4c84 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IResourceSkusOperations.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ResourceSkusOperations operations. + /// + public partial interface IResourceSkusOperations + { + /// + /// Gets the list of Microsoft.Compute SKUs available for your + /// Subscription. + /// + /// + /// The filter to apply on the operation. Only **location** filter is + /// supported currently. + /// + /// + /// To Include Extended Locations information or not in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string filter = default(string), string includeExtendedLocations = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Microsoft.Compute SKUs available for your + /// Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IRestorePointCollectionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IRestorePointCollectionsOperations.cs new file mode 100644 index 000000000000..7bb5326a2735 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IRestorePointCollectionsOperations.cs @@ -0,0 +1,255 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RestorePointCollectionsOperations operations. + /// + public partial interface IRestorePointCollectionsOperations + { + /// + /// The operation to create or update the restore point collection. + /// Please refer to https://aka.ms/RestorePoints for more details. When + /// updating a restore point collection, only tags may be modified. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Create or Update restore point + /// collection operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, RestorePointCollection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the restore point collection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Update restore point collection + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, RestorePointCollectionUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the restore point collection. This + /// operation will also delete all the contained restore points. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the restore point collection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The expand expression to apply on the operation. If + /// expand=restorePoints, server will return all contained restore + /// points in the restorePointCollection. Possible values include: + /// 'restorePoints' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore + /// point collections. Do this till nextLink is not null to fetch all + /// the restore point collections. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the restore point collection. This + /// operation will also delete all the contained restore points. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore + /// point collections. Do this till nextLink is not null to fetch all + /// the restore point collections. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IRestorePointsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IRestorePointsOperations.cs new file mode 100644 index 000000000000..f8811ef42ea6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IRestorePointsOperations.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RestorePointsOperations operations. + /// + public partial interface IRestorePointsOperations + { + /// + /// The operation to create the restore point. Updating properties of + /// an existing restore point is not allowed + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// retrieves information about the run-time state of a restore point. + /// Possible values include: 'instanceView' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create the restore point. Updating properties of + /// an existing restore point is not allowed + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleriesOperations.cs new file mode 100644 index 000000000000..369d638e16b0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleriesOperations.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleriesOperations operations. + /// + public partial interface ISharedGalleriesOperations + { + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..f885944fb8f4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImageVersionsOperations.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImageVersionsOperations operations. + /// + public partial interface ISharedGalleryImageVersionsOperations + { + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to + /// follow semantic version name pattern: The allowed characters are + /// digit and period. Digits must be within the range of a 32-bit + /// integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImagesOperations.cs new file mode 100644 index 000000000000..29684dfca5e7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ISharedGalleryImagesOperations.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImagesOperations operations. + /// + public partial interface ISharedGalleryImagesOperations + { + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when + /// doing listing operations. Possible values include: 'tenant' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the + /// Image Versions are to be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ISnapshotsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ISnapshotsOperations.cs new file mode 100644 index 000000000000..542bdf833944 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ISnapshotsOperations.cs @@ -0,0 +1,430 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SnapshotsOperations operations. + /// + public partial interface ISnapshotsOperations + { + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be + /// changed after the snapshot is created. Supported characters for the + /// name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ISshPublicKeysOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ISshPublicKeysOperations.cs new file mode 100644 index 000000000000..9b4190bfc602 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ISshPublicKeysOperations.cs @@ -0,0 +1,251 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SshPublicKeysOperations operations. + /// + public partial interface ISshPublicKeysOperations + { + /// + /// Lists all of the SSH public keys in the subscription. Use the + /// nextLink property in the response to get the next page of SSH + /// public keys. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// SSH public keys. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GenerateKeyPairWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the subscription. Use the + /// nextLink property in the response to get the next page of SSH + /// public keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the SSH public keys in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// SSH public keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IUsageOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IUsageOperations.cs new file mode 100644 index 000000000000..85f01597fb85 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IUsageOperations.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsageOperations operations. + /// + public partial interface IUsageOperations + { + /// + /// Gets, for the specified location, the current compute resource + /// usage information as well as the limits for compute resources under + /// the subscription. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets, for the specified location, the current compute resource + /// usage information as well as the limits for compute resources under + /// the subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionImagesOperations.cs new file mode 100644 index 000000000000..f3bf0652823e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionImagesOperations.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineExtensionImagesOperations operations. + /// + public partial interface IVirtualMachineExtensionImagesOperations + { + /// + /// Gets a virtual machine extension image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publisherName, string type, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListTypesWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListVersionsWithHttpMessagesAsync(string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionsOperations.cs new file mode 100644 index 000000000000..174428de7538 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineExtensionsOperations.cs @@ -0,0 +1,270 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineExtensionsOperations operations. + /// + public partial interface IVirtualMachineExtensionsOperations + { + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// created or updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// created or updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be + /// deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesEdgeZoneOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 000000000000..3beead36a4a6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,197 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + public partial interface IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that + /// matches supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData + /// query. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image offers for the specified + /// location, edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image publishers for the specified + /// Azure location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image SKUs for the specified + /// location, edge zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesOperations.cs new file mode 100644 index 000000000000..d4764f01912b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineImagesOperations.cs @@ -0,0 +1,204 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineImagesOperations operations. + /// + public partial interface IVirtualMachineImagesOperations + { + /// + /// Gets a virtual machine image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image offers for the specified + /// location and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOffersWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image publishers for the specified + /// Azure location. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListPublishersWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of virtual machine image SKUs for the specified + /// location, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusWithHttpMessagesAsync(string location, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machine image versions for the specified + /// edge zone + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByEdgeZoneWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineRunCommandsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineRunCommandsOperations.cs new file mode 100644 index 000000000000..229f8903879e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineRunCommandsOperations.cs @@ -0,0 +1,361 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineRunCommandsOperations operations. + /// + public partial interface IVirtualMachineRunCommandsOperations + { + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string location, string commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// created or updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// created or updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be + /// deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByVirtualMachineNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetExtensionsOperations.cs new file mode 100644 index 000000000000..d07dad068a72 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetExtensionsOperations.cs @@ -0,0 +1,281 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetExtensionsOperations operations. + /// + public partial interface IVirtualMachineScaleSetExtensionsOperations + { + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs new file mode 100644 index 000000000000..b866585a44dd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetRollingUpgradesOperations.cs @@ -0,0 +1,197 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetRollingUpgradesOperations operations. + /// + public partial interface IVirtualMachineScaleSetRollingUpgradesOperations + { + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task CancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all virtual machine scale set + /// instances to the latest available Platform Image OS version. + /// Instances which are already running the latest available OS version + /// are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of the latest virtual machine scale set rolling + /// upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetLatestWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginCancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a rolling upgrade to move all virtual machine scale set + /// instances to the latest available Platform Image OS version. + /// Instances which are already running the latest available OS version + /// are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 000000000000..1ccfa9151680 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,289 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all extensions of an instance in Virtual + /// Machine Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMRunCommandsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMRunCommandsOperations.cs new file mode 100644 index 000000000000..bab27f051589 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMRunCommandsOperations.cs @@ -0,0 +1,312 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMRunCommandsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMRunCommandsOperations + { + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all run commands of an instance in Virtual + /// Machine Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all run commands of an instance in Virtual + /// Machine Scaleset. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 000000000000..b17af62b033d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,827 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMsOperations + { + /// + /// Reimages (upgrade the operating system) a specific virtual machine + /// in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Allows you to re-image all the disks ( including data disks ) in + /// the a VM scale set instance. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts + /// down the virtual machine and releases the compute resources it + /// uses. You are not billed for the compute resources of this virtual + /// machine once it is deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// will retrieve the instance view of the virtual machine. 'UserData' + /// will retrieve the UserData of the virtual machine. Possible values + /// include: 'instanceView', 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that + /// resources are still attached and you are getting charged for the + /// resources. Instead, use deallocate to release resources and avoid + /// charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a + /// virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value + /// between 1 to 1440 minutes. **Note:** If not specified, SAS URIs + /// will be generated with a default expiration duration of 120 + /// minutes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to simulate the eviction of spot virtual machine in a + /// VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) a specific virtual machine + /// in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Allows you to re-image all the disks ( including data disks ) in + /// the a VM scale set instance. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts + /// down the virtual machine and releases the compute resources it + /// uses. You are not billed for the compute resources of this virtual + /// machine once it is deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create + /// or updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM + /// scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that + /// resources are still attached and you are getting charged for the + /// resources. Instead, use deallocate to release resources and avoid + /// charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetsOperations.cs new file mode 100644 index 000000000000..b86a3f4a1158 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineScaleSetsOperations.cs @@ -0,0 +1,1235 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + public partial interface IVirtualMachineScaleSetsOperations + { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are + /// queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The expand expression to apply on the operation. 'UserData' + /// retrieves the UserData property of the VM scale set that was + /// provided by the user during the VM scale set Create/Update + /// operation. Possible values include: 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down + /// the virtual machines and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine + /// scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale + /// set. (This feature is available for VMSS with Flexible + /// OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of + /// the associated resource group. Use nextLink property in the + /// response to get the next page of VM Scale Sets. Do this till + /// nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SKUs available for your VM scale set, including the + /// minimum and maximum VM instances allowed for each SKU. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetOSUpgradeHistoryWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) one or more virtual machines in a VM scale set. + /// Note that resources are still attached and you are getting charged + /// for the resources. Instead, use deallocate to release resources and + /// avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to + /// the Virtual Machine Instances + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Perform maintenance on one or more virtual machines in a VM scale + /// set. Operation on instances which are not eligible for perform + /// maintenance will be failed. Please refer to best practices for more + /// details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upgrades one or more virtual machines to the latest SKU set in the + /// VM scale set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) one or more virtual + /// machines in a VM scale set which don't have a ephemeral OS disk, + /// for virtual machines who have a ephemeral OS disk the virtual + /// machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages all the disks ( including data disks ) in the virtual + /// machines in a VM scale set. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Manual platform update domain walk to update virtual machines in a + /// service fabric virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is + /// requested + /// + /// + /// The zone in which the manual recovery walk is requested for cross + /// zone virtual machine scale set + /// + /// + /// The placement group id for which the manual recovery walk is + /// requested. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, string zone = default(string), string placementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Converts SinglePlacementGroup property to false for a existing + /// virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use + /// Virtual Machine Scale Set VMs - Get API. If not provided, the + /// platform will choose one with maximum number of virtual machine + /// instances. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ConvertToSinglePlacementGroupWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task SetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in + /// Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down + /// the virtual machines and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine + /// scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale + /// set. (This feature is available for VMSS with Flexible + /// OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM + /// scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Power off (stop) one or more virtual machines in a VM scale set. + /// Note that resources are still attached and you are getting charged + /// for the resources. Instead, use deallocate to release resources and + /// avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to + /// the Virtual Machine Instances + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Perform maintenance on one or more virtual machines in a VM scale + /// set. Operation on instances which are not eligible for perform + /// maintenance will be failed. Please refer to best practices for more + /// details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upgrades one or more virtual machines to the latest SKU set in the + /// VM scale set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginUpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) one or more virtual + /// machines in a VM scale set which don't have a ephemeral OS disk, + /// for virtual machines who have a ephemeral OS disk the virtual + /// machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages all the disks ( including data disks ) in the virtual + /// machines in a VM scale set. This operation is only supported for + /// managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginSetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of + /// the associated resource group. Use nextLink property in the + /// response to get the next page of VM Scale Sets. Do this till + /// nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SKUs available for your VM scale set, including the + /// minimum and maximum VM instances allowed for each SKU. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetOSUpgradeHistoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineSizesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineSizesOperations.cs new file mode 100644 index 000000000000..616cad288333 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachineSizesOperations.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineSizesOperations operations. + /// + public partial interface IVirtualMachineSizesOperations + { + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachinesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachinesOperations.cs new file mode 100644 index 000000000000..f23c4a56c01e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/IVirtualMachinesOperations.cs @@ -0,0 +1,1195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachinesOperations operations. + /// + public partial interface IVirtualMachinesOperations + { + /// + /// Gets all the virtual machines under the specified subscription for + /// the specified location. + /// + /// + /// The location for which virtual machines under the subscription are + /// queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs + /// a template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a virtual machine. Please note + /// some properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about the model view or the instance view of + /// a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' + /// retrieves a snapshot of the runtime properties of the virtual + /// machine that is managed by the platform and can change outside of + /// control plane operations. 'UserData' retrieves the UserData + /// property as part of the VM model view that was provided by the user + /// during the VM Create/Update operation. Possible values include: + /// 'instanceView', 'userData' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves information about the run-time state of a virtual + /// machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> InstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Converts virtual machine disks from blob-based to managed disks. + /// Virtual machine must be stop-deallocated before invoking this + /// operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine and releases the compute resources. + /// You are not billed for the compute resources that this virtual + /// machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in + /// Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? hibernate = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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). + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task GeneralizeWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// The name of the resource group. + /// + /// + /// The system query option to filter VMs returned in the response. + /// Allowed value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values + /// include: 'instanceView' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified subscription. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual + /// Machines in the subscription. + /// + /// + /// The system query option to filter VMs returned in the response. + /// Allowed value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values + /// include: 'instanceView' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllWithHttpMessagesAsync(string statusOnly = default(string), string filter = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available virtual machine sizes to which the specified + /// virtual machine can be resized. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to power off (stop) a virtual machine. The virtual + /// machine can be restarted with the same provisioned resources. You + /// are still charged for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) a virtual machine which + /// don't have a ephemeral OS disk, for virtual machines who have a + /// ephemeral OS disk the virtual machine is reset to initial state. + /// NOTE: The retaining of old OS disk depends on the value of + /// deleteOption of OS disk. If deleteOption is detach, the old OS disk + /// will be preserved after reimage. If deleteOption is delete, the old + /// OS disk will be deleted after reimage. The deleteOption of the OS + /// disk should be updated accordingly before performing the reimage. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot + /// diagnostic logs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value + /// between 1 to 1440 minutes. **Note:** If not specified, SAS URIs + /// will be generated with a default expiration duration of 120 + /// minutes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> AssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs + /// a template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a virtual machine. Please note + /// some properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Converts virtual machine disks from blob-based to managed disks. + /// Virtual machine must be stop-deallocated before invoking this + /// operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine and releases the compute resources. + /// You are not billed for the compute resources that this virtual + /// machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in + /// Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? hibernate = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to power off (stop) a virtual machine. The virtual + /// machine can be restarted with the same provisioned resources. You + /// are still charged for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for + /// this flag indicates non-graceful shutdown whereas false indicates + /// otherwise. Default value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages (upgrade the operating system) a virtual machine which + /// don't have a ephemeral OS disk, for virtual machines who have a + /// ephemeral OS disk the virtual machine is reset to initial state. + /// NOTE: The retaining of old OS disk depends on the value of + /// deleteOption of OS disk. If deleteOption is detach, the old OS disk + /// will be preserved after reimage. If deleteOption is delete, the old + /// OS disk will be deleted after reimage. The deleteOption of the OS + /// disk should be updated accordingly before performing the reimage. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginAssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the virtual machines under the specified subscription for + /// the specified location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified resource group. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the virtual machines in the specified subscription. + /// Use the nextLink property in the response to get the next page of + /// virtual machines. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ImagesOperations.cs new file mode 100644 index 000000000000..f18779c092f9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ImagesOperations.cs @@ -0,0 +1,1672 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ImagesOperations operations. + /// + internal partial class ImagesOperations : IServiceOperations, IImagesOperations + { + /// + /// Initializes a new instance of the ImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, imageName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string imageName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, Image parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update an image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string imageName, ImageUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Image. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string imageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (imageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "imageName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("imageName", imageName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{imageName}", System.Uri.EscapeDataString(imageName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/ImagesOperationsExtensions.cs new file mode 100644 index 000000000000..486dffbb0b10 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ImagesOperationsExtensions.cs @@ -0,0 +1,475 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ImagesOperations. + /// + public static partial class ImagesOperationsExtensions + { + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + public static Image CreateOrUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + public static Image Update(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + public static void Delete(this IImagesOperations operations, string resourceGroupName, string imageName) + { + operations.DeleteAsync(resourceGroupName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IImagesOperations operations, string resourceGroupName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, imageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + public static Image Get(this IImagesOperations operations, string resourceGroupName, string imageName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, imageName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IImagesOperations operations, string resourceGroupName, string imageName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, imageName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IImagesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IImagesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IImagesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IImagesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + public static Image BeginCreateOrUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Create Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, Image parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + public static Image BeginUpdate(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, imageName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update an image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// Parameters supplied to the Update Image operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IImagesOperations operations, string resourceGroupName, string imageName, ImageUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, imageName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + public static void BeginDelete(this IImagesOperations operations, string resourceGroupName, string imageName) + { + operations.BeginDeleteAsync(resourceGroupName, imageName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the image. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IImagesOperations operations, string resourceGroupName, string imageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, imageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IImagesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of images under a resource group. Use nextLink property in + /// the response to get the next page of Images. Do this till nextLink is null + /// to fetch all the Images. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperations.cs new file mode 100644 index 000000000000..c40f2a9b4787 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperations.cs @@ -0,0 +1,522 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LogAnalyticsOperations operations. + /// + internal partial class LogAnalyticsOperations : IServiceOperations, ILogAnalyticsOperations + { + /// + /// Initializes a new instance of the LogAnalyticsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LogAnalyticsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportThrottledRequestsWithHttpMessagesAsync(parameters, location, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginExportRequestRateByIntervalWithHttpMessagesAsync(RequestRateByIntervalInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportRequestRateByInterval", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginExportThrottledRequestsWithHttpMessagesAsync(ThrottledRequestsInput parameters, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportThrottledRequests", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperationsExtensions.cs new file mode 100644 index 000000000000..de07f1b3d5fd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/LogAnalyticsOperationsExtensions.cs @@ -0,0 +1,193 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LogAnalyticsOperations. + /// + public static partial class LogAnalyticsOperationsExtensions + { + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult ExportRequestRateByInterval(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location) + { + return operations.ExportRequestRateByIntervalAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task ExportRequestRateByIntervalAsync(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult ExportThrottledRequests(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location) + { + return operations.ExportThrottledRequestsAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task ExportThrottledRequestsAsync(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportThrottledRequestsWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult BeginExportRequestRateByInterval(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location) + { + return operations.BeginExportRequestRateByIntervalAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show Api requests made by this subscription in the given + /// time window to show throttling activities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportRequestRateByIntervalAsync(this ILogAnalyticsOperations operations, RequestRateByIntervalInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportRequestRateByIntervalWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static LogAnalyticsOperationResult BeginExportThrottledRequests(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location) + { + return operations.BeginExportThrottledRequestsAsync(parameters, location).GetAwaiter().GetResult(); + } + + /// + /// Export logs that show total throttled Api requests for this subscription in + /// the given time window. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportThrottledRequestsAsync(this ILogAnalyticsOperations operations, ThrottledRequestsInput parameters, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportThrottledRequestsWithHttpMessagesAsync(parameters, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AccessLevel.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AccessLevel.cs new file mode 100644 index 000000000000..b23ace763aa6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AccessLevel.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for AccessLevel. + /// + public static class AccessLevel + { + public const string None = "None"; + public const string Read = "Read"; + public const string Write = "Write"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AccessUri.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AccessUri.cs new file mode 100644 index 000000000000..722ecd930dce --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AccessUri.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A disk access SAS uri. + /// + public partial class AccessUri + { + /// + /// Initializes a new instance of the AccessUri class. + /// + public AccessUri() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessUri class. + /// + /// A SAS uri for accessing a disk. + /// A SAS uri for accessing a VM + /// guest state. + public AccessUri(string accessSAS = default(string), string securityDataAccessSAS = default(string)) + { + AccessSAS = accessSAS; + SecurityDataAccessSAS = securityDataAccessSAS; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a SAS uri for accessing a disk. + /// + [JsonProperty(PropertyName = "accessSAS")] + public string AccessSAS { get; private set; } + + /// + /// Gets a SAS uri for accessing a VM guest state. + /// + [JsonProperty(PropertyName = "securityDataAccessSAS")] + public string SecurityDataAccessSAS { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalCapabilities.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalCapabilities.cs new file mode 100644 index 000000000000..18f8541b7633 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalCapabilities.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Enables or disables a capability on the virtual machine or virtual + /// machine scale set. + /// + public partial class AdditionalCapabilities + { + /// + /// Initializes a new instance of the AdditionalCapabilities class. + /// + public AdditionalCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdditionalCapabilities class. + /// + /// The flag that enables or disables a + /// capability to have one or more managed data disks with UltraSSD_LRS + /// storage account type on the VM or VMSS. Managed disks with storage + /// account type UltraSSD_LRS can be added to a virtual machine or + /// virtual machine scale set only if this property is enabled. + /// The flag that enables or disables + /// hibernation capability on the VM. + public AdditionalCapabilities(bool? ultraSSDEnabled = default(bool?), bool? hibernationEnabled = default(bool?)) + { + UltraSSDEnabled = ultraSSDEnabled; + HibernationEnabled = hibernationEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the flag that enables or disables a capability to have + /// one or more managed data disks with UltraSSD_LRS storage account + /// type on the VM or VMSS. Managed disks with storage account type + /// UltraSSD_LRS can be added to a virtual machine or virtual machine + /// scale set only if this property is enabled. + /// + [JsonProperty(PropertyName = "ultraSSDEnabled")] + public bool? UltraSSDEnabled { get; set; } + + /// + /// Gets or sets the flag that enables or disables hibernation + /// capability on the VM. + /// + [JsonProperty(PropertyName = "hibernationEnabled")] + public bool? HibernationEnabled { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalUnattendContent.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalUnattendContent.cs new file mode 100644 index 000000000000..b7aac7275880 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AdditionalUnattendContent.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies additional XML formatted information that can be included in + /// the Unattend.xml file, which is used by Windows Setup. Contents are + /// defined by setting name, component name, and the pass in which the + /// content is applied. + /// + public partial class AdditionalUnattendContent + { + /// + /// Initializes a new instance of the AdditionalUnattendContent class. + /// + public AdditionalUnattendContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdditionalUnattendContent class. + /// + /// The pass name. Currently, the only allowable + /// value is OobeSystem. Possible values include: 'OobeSystem' + /// The component name. Currently, the only + /// allowable value is Microsoft-Windows-Shell-Setup. Possible values + /// include: 'Microsoft-Windows-Shell-Setup' + /// Specifies the name of the setting to + /// which the content applies. Possible values are: FirstLogonCommands + /// and AutoLogon. Possible values include: 'AutoLogon', + /// 'FirstLogonCommands' + /// Specifies the XML formatted content that is + /// added to the unattend.xml file for the specified path and + /// component. The XML must be less than 4KB and must include the root + /// element for the setting or feature that is being inserted. + public AdditionalUnattendContent(PassNames? passName = default(PassNames?), ComponentNames? componentName = default(ComponentNames?), SettingNames? settingName = default(SettingNames?), string content = default(string)) + { + PassName = passName; + ComponentName = componentName; + SettingName = settingName; + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the pass name. Currently, the only allowable value is + /// OobeSystem. Possible values include: 'OobeSystem' + /// + [JsonProperty(PropertyName = "passName")] + public PassNames? PassName { get; set; } + + /// + /// Gets or sets the component name. Currently, the only allowable + /// value is Microsoft-Windows-Shell-Setup. Possible values include: + /// 'Microsoft-Windows-Shell-Setup' + /// + [JsonProperty(PropertyName = "componentName")] + public ComponentNames? ComponentName { get; set; } + + /// + /// Gets or sets specifies the name of the setting to which the content + /// applies. Possible values are: FirstLogonCommands and AutoLogon. + /// Possible values include: 'AutoLogon', 'FirstLogonCommands' + /// + [JsonProperty(PropertyName = "settingName")] + public SettingNames? SettingName { get; set; } + + /// + /// Gets or sets specifies the XML formatted content that is added to + /// the unattend.xml file for the specified path and component. The XML + /// must be less than 4KB and must include the root element for the + /// setting or feature that is being inserted. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AggregatedReplicationState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AggregatedReplicationState.cs new file mode 100644 index 000000000000..b3a4f61130c9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AggregatedReplicationState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for AggregatedReplicationState. + /// + public static class AggregatedReplicationState + { + public const string Unknown = "Unknown"; + public const string InProgress = "InProgress"; + public const string Completed = "Completed"; + public const string Failed = "Failed"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeOption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeOption.cs new file mode 100644 index 000000000000..0c1db05e4858 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeOption.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the alternative option specified by the Publisher for this + /// image when this image is deprecated. + /// + public partial class AlternativeOption + { + /// + /// Initializes a new instance of the AlternativeOption class. + /// + public AlternativeOption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlternativeOption class. + /// + /// Describes the type of the alternative option. + /// Possible values include: 'None', 'Offer', 'Plan' + /// Indicates the alternative option value + /// specified by the Publisher. This is the Offer name when the type is + /// Offer or the Plan name when the type is Plan. + public AlternativeOption(string type = default(string), string value = default(string)) + { + Type = type; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the type of the alternative option. Possible + /// values include: 'None', 'Offer', 'Plan' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets indicates the alternative option value specified by + /// the Publisher. This is the Offer name when the type is Offer or the + /// Plan name when the type is Plan. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeType.cs new file mode 100644 index 000000000000..ad49f56a5139 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AlternativeType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for AlternativeType. + /// + public static class AlternativeType + { + public const string None = "None"; + public const string Offer = "Offer"; + public const string Plan = "Plan"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ApiEntityReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiEntityReference.cs new file mode 100644 index 000000000000..85ecc19c8859 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiEntityReference.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The API entity reference. + /// + public partial class ApiEntityReference + { + /// + /// Initializes a new instance of the ApiEntityReference class. + /// + public ApiEntityReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiEntityReference class. + /// + /// The ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + public ApiEntityReference(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ApiError.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiError.cs new file mode 100644 index 000000000000..f29314dc30a0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiError.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Api error. + /// + public partial class ApiError + { + /// + /// Initializes a new instance of the ApiError class. + /// + public ApiError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiError class. + /// + /// The Api error details + /// The Api inner error + /// The error code. + /// The target of the particular error. + /// The error message. + public ApiError(IList details = default(IList), InnerError innererror = default(InnerError), string code = default(string), string target = default(string), string message = default(string)) + { + Details = details; + Innererror = innererror; + Code = code; + Target = target; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Api error details + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Gets or sets the Api inner error + /// + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ApiErrorBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiErrorBase.cs new file mode 100644 index 000000000000..11cb3c5701e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ApiErrorBase.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Api error base. + /// + public partial class ApiErrorBase + { + /// + /// Initializes a new instance of the ApiErrorBase class. + /// + public ApiErrorBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiErrorBase class. + /// + /// The error code. + /// The target of the particular error. + /// The error message. + public ApiErrorBase(string code = default(string), string target = default(string), string message = default(string)) + { + Code = code; + Target = target; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ApplicationProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ApplicationProfile.cs new file mode 100644 index 000000000000..4b7ed0d431ce --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ApplicationProfile.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contains the list of gallery applications that should be made available + /// to the VM/VMSS + /// + public partial class ApplicationProfile + { + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + public ApplicationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationProfile class. + /// + /// Specifies the gallery + /// applications that should be made available to the VM/VMSS + public ApplicationProfile(IList galleryApplications = default(IList)) + { + GalleryApplications = galleryApplications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "galleryApplications")] + public IList GalleryApplications { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Architecture.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Architecture.cs new file mode 100644 index 000000000000..592633e05740 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Architecture.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for Architecture. + /// + public static class Architecture + { + public const string X64 = "x64"; + public const string Arm64 = "Arm64"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ArchitectureTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ArchitectureTypes.cs new file mode 100644 index 000000000000..954bb0b2e37e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ArchitectureTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ArchitectureTypes. + /// + public static class ArchitectureTypes + { + public const string X64 = "x64"; + public const string Arm64 = "Arm64"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradePolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradePolicy.cs new file mode 100644 index 000000000000..e1fe591de668 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradePolicy.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The configuration parameters used for performing automatic OS upgrade. + /// + public partial class AutomaticOSUpgradePolicy + { + /// + /// Initializes a new instance of the AutomaticOSUpgradePolicy class. + /// + public AutomaticOSUpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticOSUpgradePolicy class. + /// + /// Indicates whether OS + /// upgrades should automatically be applied to scale set instances in + /// a rolling fashion when a newer version of the OS image becomes + /// available. Default value is false. If this is set to true for + /// Windows based scale sets, + /// [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + /// is automatically set to false and cannot be set to true. + /// Whether OS image rollback + /// feature should be disabled. Default value is false. + /// Indicates whether rolling + /// upgrade policy should be used during Auto OS Upgrade. Default value + /// is false. Auto OS Upgrade will fallback to the default policy if no + /// policy is defined on the VMSS. + public AutomaticOSUpgradePolicy(bool? enableAutomaticOSUpgrade = default(bool?), bool? disableAutomaticRollback = default(bool?), bool? useRollingUpgradePolicy = default(bool?)) + { + EnableAutomaticOSUpgrade = enableAutomaticOSUpgrade; + DisableAutomaticRollback = disableAutomaticRollback; + UseRollingUpgradePolicy = useRollingUpgradePolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether OS upgrades should automatically be + /// applied to scale set instances in a rolling fashion when a newer + /// version of the OS image becomes available. Default value is false. + /// If this is set to true for Windows based scale sets, + /// [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + /// is automatically set to false and cannot be set to true. + /// + [JsonProperty(PropertyName = "enableAutomaticOSUpgrade")] + public bool? EnableAutomaticOSUpgrade { get; set; } + + /// + /// Gets or sets whether OS image rollback feature should be disabled. + /// Default value is false. + /// + [JsonProperty(PropertyName = "disableAutomaticRollback")] + public bool? DisableAutomaticRollback { get; set; } + + /// + /// Gets or sets indicates whether rolling upgrade policy should be + /// used during Auto OS Upgrade. Default value is false. Auto OS + /// Upgrade will fallback to the default policy if no policy is defined + /// on the VMSS. + /// + [JsonProperty(PropertyName = "useRollingUpgradePolicy")] + public bool? UseRollingUpgradePolicy { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradeProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradeProperties.cs new file mode 100644 index 000000000000..2b459e236be1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticOSUpgradeProperties.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes automatic OS upgrade properties on the image. + /// + public partial class AutomaticOSUpgradeProperties + { + /// + /// Initializes a new instance of the AutomaticOSUpgradeProperties + /// class. + /// + public AutomaticOSUpgradeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticOSUpgradeProperties + /// class. + /// + /// Specifies whether + /// automatic OS upgrade is supported on the image. + public AutomaticOSUpgradeProperties(bool automaticOSUpgradeSupported) + { + AutomaticOSUpgradeSupported = automaticOSUpgradeSupported; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether automatic OS upgrade is supported on + /// the image. + /// + [JsonProperty(PropertyName = "automaticOSUpgradeSupported")] + public bool AutomaticOSUpgradeSupported { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticRepairsPolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticRepairsPolicy.cs new file mode 100644 index 000000000000..77069f584cc0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AutomaticRepairsPolicy.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the configuration parameters for automatic repairs on the + /// virtual machine scale set. + /// + public partial class AutomaticRepairsPolicy + { + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + public AutomaticRepairsPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + /// Specifies whether automatic repairs should be + /// enabled on the virtual machine scale set. The default value is + /// false. + /// The amount of time for which automatic + /// repairs are suspended due to a state change on VM. The grace time + /// starts after the state change has completed. This helps avoid + /// premature or accidental repairs. The time duration should be + /// specified in ISO 8601 format. The minimum allowed grace period is + /// 10 minutes (PT10M), which is also the default value. The maximum + /// allowed grace period is 90 minutes (PT90M). + /// Type of repair action (replace, restart, + /// reimage) that will be used for repairing unhealthy virtual machines + /// in the scale set. Default value is replace. Possible values + /// include: 'Replace', 'Restart', 'Reimage' + public AutomaticRepairsPolicy(bool? enabled = default(bool?), string gracePeriod = default(string), string repairAction = default(string)) + { + Enabled = enabled; + GracePeriod = gracePeriod; + RepairAction = repairAction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether automatic repairs should be enabled + /// on the virtual machine scale set. The default value is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the amount of time for which automatic repairs are + /// suspended due to a state change on VM. The grace time starts after + /// the state change has completed. This helps avoid premature or + /// accidental repairs. The time duration should be specified in ISO + /// 8601 format. The minimum allowed grace period is 10 minutes + /// (PT10M), which is also the default value. The maximum allowed grace + /// period is 90 minutes (PT90M). + /// + [JsonProperty(PropertyName = "gracePeriod")] + public string GracePeriod { get; set; } + + /// + /// Gets or sets type of repair action (replace, restart, reimage) that + /// will be used for repairing unhealthy virtual machines in the scale + /// set. Default value is replace. Possible values include: 'Replace', + /// 'Restart', 'Reimage' + /// + [JsonProperty(PropertyName = "repairAction")] + public string RepairAction { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySet.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySet.cs new file mode 100644 index 000000000000..9e7600cfebad --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySet.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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 + /// [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance and + /// updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to an availability set at creation + /// time. An existing VM cannot be added to an availability set. + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailabilitySet : Resource + { + /// + /// Initializes a new instance of the AvailabilitySet class. + /// + public AvailabilitySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailabilitySet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Update Domain + /// count. + /// Fault Domain count. + /// A list of references to all virtual + /// machines in the availability set. + /// Specifies information about + /// the proximity placement group that the availability set should be + /// assigned to. Minimum api-version: 2018-04-01. + /// The resource status information. + /// 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'. + public AvailabilitySet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? platformUpdateDomainCount = default(int?), int? platformFaultDomainCount = default(int?), IList virtualMachines = default(IList), SubResource proximityPlacementGroup = default(SubResource), IList statuses = default(IList), Sku sku = default(Sku)) + : base(location, id, name, type, tags) + { + PlatformUpdateDomainCount = platformUpdateDomainCount; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachines = virtualMachines; + ProximityPlacementGroup = proximityPlacementGroup; + Statuses = statuses; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets update Domain count. + /// + [JsonProperty(PropertyName = "properties.platformUpdateDomainCount")] + public int? PlatformUpdateDomainCount { get; set; } + + /// + /// Gets or sets fault Domain count. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets a list of references to all virtual machines in the + /// availability set. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the availability set should be assigned to. Minimum + /// api-version: 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets the resource status information. + /// + [JsonProperty(PropertyName = "properties.statuses")] + public IList Statuses { get; private set; } + + /// + /// Gets or sets 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'. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetSkuTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetSkuTypes.cs new file mode 100644 index 000000000000..489413a557c2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetSkuTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for AvailabilitySetSkuTypes. + /// + public static class AvailabilitySetSkuTypes + { + public const string Classic = "Classic"; + public const string Aligned = "Aligned"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetUpdate.cs new file mode 100644 index 000000000000..5ee006df42aa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailabilitySetUpdate.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the availability set that the virtual + /// machine should be assigned to. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailabilitySetUpdate : UpdateResource + { + /// + /// Initializes a new instance of the AvailabilitySetUpdate class. + /// + public AvailabilitySetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailabilitySetUpdate class. + /// + /// Resource tags + /// Update Domain + /// count. + /// Fault Domain count. + /// A list of references to all virtual + /// machines in the availability set. + /// Specifies information about + /// the proximity placement group that the availability set should be + /// assigned to. Minimum api-version: 2018-04-01. + /// The resource status information. + /// Sku of the availability set + public AvailabilitySetUpdate(IDictionary tags = default(IDictionary), int? platformUpdateDomainCount = default(int?), int? platformFaultDomainCount = default(int?), IList virtualMachines = default(IList), SubResource proximityPlacementGroup = default(SubResource), IList statuses = default(IList), Sku sku = default(Sku)) + : base(tags) + { + PlatformUpdateDomainCount = platformUpdateDomainCount; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachines = virtualMachines; + ProximityPlacementGroup = proximityPlacementGroup; + Statuses = statuses; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets update Domain count. + /// + [JsonProperty(PropertyName = "properties.platformUpdateDomainCount")] + public int? PlatformUpdateDomainCount { get; set; } + + /// + /// Gets or sets fault Domain count. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets a list of references to all virtual machines in the + /// availability set. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the availability set should be assigned to. Minimum + /// api-version: 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets the resource status information. + /// + [JsonProperty(PropertyName = "properties.statuses")] + public IList Statuses { get; private set; } + + /// + /// Gets or sets sku of the availability set + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/AvailablePatchSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailablePatchSummary.cs new file mode 100644 index 000000000000..322c7909b592 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/AvailablePatchSummary.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of an virtual machine instance view for + /// available patch summary. + /// + public partial class AvailablePatchSummary + { + /// + /// Initializes a new instance of the AvailablePatchSummary class. + /// + public AvailablePatchSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailablePatchSummary class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the operation + /// that produced this result. It is used to correlate across CRP and + /// extension logs. + /// The overall reboot status of the VM. It + /// will be true when partially installed patches require a reboot to + /// complete installation but the reboot has not yet occurred. + /// The number of critical + /// or security patches that have been detected as available and not + /// yet installed. + /// The number of all available patches + /// excluding critical and security. + /// The UTC timestamp when the operation + /// began. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public AvailablePatchSummary(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + AssessmentActivityId = assessmentActivityId; + RebootPending = rebootPending; + CriticalAndSecurityPatchCount = criticalAndSecurityPatchCount; + OtherPatchCount = otherPatchCount; + StartTime = startTime; + LastModifiedTime = lastModifiedTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "assessmentActivityId")] + public string AssessmentActivityId { get; private set; } + + /// + /// Gets the overall reboot status of the VM. It will be true when + /// partially installed patches require a reboot to complete + /// installation but the reboot has not yet occurred. + /// + [JsonProperty(PropertyName = "rebootPending")] + public bool? RebootPending { get; private set; } + + /// + /// Gets the number of critical or security patches that have been + /// detected as available and not yet installed. + /// + [JsonProperty(PropertyName = "criticalAndSecurityPatchCount")] + public int? CriticalAndSecurityPatchCount { get; private set; } + + /// + /// Gets the number of all available patches excluding critical and + /// security. + /// + [JsonProperty(PropertyName = "otherPatchCount")] + public int? OtherPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/BillingProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/BillingProfile.cs new file mode 100644 index 000000000000..edb2595ca073 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/BillingProfile.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the billing related details of a Azure Spot VM or VMSS. + /// Minimum api-version: 2019-03-01. + /// + public partial class BillingProfile + { + /// + /// Initializes a new instance of the BillingProfile class. + /// + public BillingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfile class. + /// + /// Specifies the maximum price you are willing + /// to pay for a Azure Spot VM/VMSS. This price is in US Dollars. + /// <br><br> This price will be compared with the current + /// Azure Spot price for the VM size. Also, the prices are compared at + /// the time of create/update of Azure Spot VM/VMSS and the operation + /// will only succeed if the maxPrice is greater than the current + /// Azure Spot price. <br><br> The maxPrice will also be + /// used for evicting a Azure Spot VM/VMSS if the current Azure Spot + /// price goes beyond the maxPrice after creation of VM/VMSS. + /// <br><br> Possible values are: <br><br> - + /// Any decimal value greater than zero. Example: 0.01538 + /// <br><br> -1 – indicates default price to be up-to + /// on-demand. <br><br> You can set the maxPrice to -1 to + /// indicate that the Azure Spot VM/VMSS should not be evicted for + /// price reasons. Also, the default max price is -1 if it is not + /// provided by you. <br><br>Minimum api-version: + /// 2019-03-01. + public BillingProfile(double? maxPrice = default(double?)) + { + MaxPrice = maxPrice; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the maximum price you are willing to pay for + /// a Azure Spot VM/VMSS. This price is in US Dollars. + /// &lt;br&gt;&lt;br&gt; This price will be compared + /// with the current Azure Spot price for the VM size. Also, the prices + /// are compared at the time of create/update of Azure Spot VM/VMSS and + /// the operation will only succeed if the maxPrice is greater than + /// the current Azure Spot price. &lt;br&gt;&lt;br&gt; + /// The maxPrice will also be used for evicting a Azure Spot VM/VMSS if + /// the current Azure Spot price goes beyond the maxPrice after + /// creation of VM/VMSS. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; - Any decimal + /// value greater than zero. Example: 0.01538 + /// &lt;br&gt;&lt;br&gt; -1 – indicates default price + /// to be up-to on-demand. &lt;br&gt;&lt;br&gt; You can + /// set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS + /// should not be evicted for price reasons. Also, the default max + /// price is -1 if it is not provided by you. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2019-03-01. + /// + [JsonProperty(PropertyName = "maxPrice")] + public double? MaxPrice { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnostics.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnostics.cs new file mode 100644 index 000000000000..20f7d09178a6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnostics.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Boot Diagnostics is a debugging feature which allows you to view + /// Console Output and Screenshot to diagnose VM status. You can easily + /// view the output of your console log. Azure also enables you to see a + /// screenshot of the VM from the hypervisor. + /// + public partial class BootDiagnostics + { + /// + /// Initializes a new instance of the BootDiagnostics class. + /// + public BootDiagnostics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BootDiagnostics class. + /// + /// Whether boot diagnostics should be enabled on + /// the Virtual Machine. + /// Uri of the storage account to use for + /// placing the console output and screenshot. If storageUri is not + /// specified while enabling boot diagnostics, managed storage will be + /// used. + public BootDiagnostics(bool? enabled = default(bool?), string storageUri = default(string)) + { + Enabled = enabled; + StorageUri = storageUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether boot diagnostics should be enabled on the + /// Virtual Machine. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets uri of the storage account to use for placing the + /// console output and screenshot. If storageUri is not specified while + /// enabling boot diagnostics, managed storage will be used. + /// + [JsonProperty(PropertyName = "storageUri")] + public string StorageUri { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnosticsInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnosticsInstanceView.cs new file mode 100644 index 000000000000..f94dbe864dc7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/BootDiagnosticsInstanceView.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The instance view of a virtual machine boot diagnostics. + /// + public partial class BootDiagnosticsInstanceView + { + /// + /// Initializes a new instance of the BootDiagnosticsInstanceView + /// class. + /// + public BootDiagnosticsInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BootDiagnosticsInstanceView + /// class. + /// + /// The console screenshot blob + /// URI. **Note:** This will **not** be set if boot diagnostics is + /// currently enabled with managed storage. + /// The serial console log blob + /// Uri. **Note:** This will **not** be set if boot diagnostics is + /// currently enabled with managed storage. + /// The boot diagnostics status information for + /// the VM. **Note:** It will be set only if there are errors + /// encountered in enabling boot diagnostics. + public BootDiagnosticsInstanceView(string consoleScreenshotBlobUri = default(string), string serialConsoleLogBlobUri = default(string), InstanceViewStatus status = default(InstanceViewStatus)) + { + ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; + SerialConsoleLogBlobUri = serialConsoleLogBlobUri; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the console screenshot blob URI. **Note:** This will **not** + /// be set if boot diagnostics is currently enabled with managed + /// storage. + /// + [JsonProperty(PropertyName = "consoleScreenshotBlobUri")] + public string ConsoleScreenshotBlobUri { get; private set; } + + /// + /// Gets the serial console log blob Uri. **Note:** This will **not** + /// be set if boot diagnostics is currently enabled with managed + /// storage. + /// + [JsonProperty(PropertyName = "serialConsoleLogBlobUri")] + public string SerialConsoleLogBlobUri { get; private set; } + + /// + /// Gets the boot diagnostics status information for the VM. **Note:** + /// It will be set only if there are errors encountered in enabling + /// boot diagnostics. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CachingTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CachingTypes.cs new file mode 100644 index 000000000000..c902e8e5286a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CachingTypes.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for CachingTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CachingTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "ReadOnly")] + ReadOnly, + [EnumMember(Value = "ReadWrite")] + ReadWrite + } + internal static class CachingTypesEnumExtension + { + internal static string ToSerializedValue(this CachingTypes? value) + { + return value == null ? null : ((CachingTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this CachingTypes value) + { + switch( value ) + { + case CachingTypes.None: + return "None"; + case CachingTypes.ReadOnly: + return "ReadOnly"; + case CachingTypes.ReadWrite: + return "ReadWrite"; + } + return null; + } + + internal static CachingTypes? ParseCachingTypes(this string value) + { + switch( value ) + { + case "None": + return CachingTypes.None; + case "ReadOnly": + return CachingTypes.ReadOnly; + case "ReadWrite": + return CachingTypes.ReadWrite; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservation.cs new file mode 100644 index 000000000000..e3292cf78002 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservation.cs @@ -0,0 +1,186 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the capacity reservation. + /// + [Rest.Serialization.JsonTransformation] + public partial class CapacityReservation : Resource + { + /// + /// Initializes a new instance of the CapacityReservation class. + /// + public CapacityReservation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservation class. + /// + /// Resource location + /// SKU of the resource for which capacity needs be + /// reserved. The SKU name and capacity is required to be set. + /// Currently VM Skus with the capability called + /// 'CapacityReservationSupported' set to true are supported. Refer to + /// List Microsoft.Compute SKUs in a region + /// (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + /// supported values. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A unique id generated and assigned to + /// the capacity reservation by the platform which does not change + /// throughout the lifetime of the resource. + /// Specifies the value of fault + /// domain count that Capacity Reservation supports for requested VM + /// size. **Note:** The fault domain count specified for a resource + /// (like virtual machines scale set) must be less than or equal to + /// this value if it deploys using capacity reservation. Minimum + /// api-version: 2022-08-01. + /// A list of all virtual + /// machine resource ids that are associated with the capacity + /// reservation. + /// The date time when the capacity + /// reservation was last updated. + /// The provisioning state, which only + /// appears in the response. + /// The Capacity reservation instance + /// view. + /// Specifies the time at which the Capacity + /// Reservation resource was created. Minimum api-version: + /// 2021-11-01. + /// Availability Zone to use for this capacity + /// reservation. The zone has to be single value and also should be + /// part for the list of zones specified during the capacity + /// reservation group creation. The zone can be assigned only during + /// creation. If not provided, the reservation supports only non-zonal + /// deployments. If provided, enforces VM/VMSS using this capacity + /// reservation to be in same zone. + public CapacityReservation(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string reservationId = default(string), int? platformFaultDomainCount = default(int?), IList virtualMachinesAssociated = default(IList), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), CapacityReservationInstanceView instanceView = default(CapacityReservationInstanceView), System.DateTime? timeCreated = default(System.DateTime?), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + ReservationId = reservationId; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique id generated and assigned to the capacity reservation + /// by the platform which does not change throughout the lifetime of + /// the resource. + /// + [JsonProperty(PropertyName = "properties.reservationId")] + public string ReservationId { get; private set; } + + /// + /// Gets specifies the value of fault domain count that Capacity + /// Reservation supports for requested VM size. **Note:** The fault + /// domain count specified for a resource (like virtual machines scale + /// set) must be less than or equal to this value if it deploys using + /// capacity reservation. Minimum api-version: 2022-08-01. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; private set; } + + /// + /// Gets a list of all virtual machine resource ids that are associated + /// with the capacity reservation. + /// + [JsonProperty(PropertyName = "properties.virtualMachinesAssociated")] + public IList VirtualMachinesAssociated { get; private set; } + + /// + /// Gets the date time when the capacity reservation was last updated. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the Capacity reservation instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public CapacityReservationInstanceView InstanceView { get; private set; } + + /// + /// Gets specifies the time at which the Capacity Reservation resource + /// was created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets SKU of the resource for which capacity needs be + /// reserved. The SKU name and capacity is required to be set. + /// Currently VM Skus with the capability called + /// 'CapacityReservationSupported' set to true are supported. Refer to + /// List Microsoft.Compute SKUs in a region + /// (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + /// supported values. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets availability Zone to use for this capacity + /// reservation. The zone has to be single value and also should be + /// part for the list of zones specified during the capacity + /// reservation group creation. The zone can be assigned only during + /// creation. If not provided, the reservation supports only non-zonal + /// deployments. If provided, enforces VM/VMSS using this capacity + /// reservation to be in same zone. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroup.cs new file mode 100644 index 000000000000..c757fc3dc40a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroup.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the capacity reservation group that the + /// capacity reservations should be assigned to. Currently, a capacity + /// reservation can only be added to a capacity reservation group at + /// creation time. An existing capacity reservation cannot be added or + /// moved to another capacity reservation group. + /// + [Rest.Serialization.JsonTransformation] + public partial class CapacityReservationGroup : Resource + { + /// + /// Initializes a new instance of the CapacityReservationGroup class. + /// + public CapacityReservationGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationGroup class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A list of all capacity + /// reservation resource ids that belong to capacity reservation + /// group. + /// A list of references to all + /// virtual machines associated to the capacity reservation + /// group. + /// The capacity reservation group instance + /// view which has the list of instance views for all the capacity + /// reservations that belong to the capacity reservation group. + /// Availability Zones to use for this capacity + /// reservation group. The zones can be assigned only during creation. + /// If not provided, the group supports only regional resources in the + /// region. If provided, enforces each capacity reservation in the + /// group to be in one of the zones. + public CapacityReservationGroup(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList capacityReservations = default(IList), IList virtualMachinesAssociated = default(IList), CapacityReservationGroupInstanceView instanceView = default(CapacityReservationGroupInstanceView), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + CapacityReservations = capacityReservations; + VirtualMachinesAssociated = virtualMachinesAssociated; + InstanceView = instanceView; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all capacity reservation resource ids that belong to + /// capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.capacityReservations")] + public IList CapacityReservations { get; private set; } + + /// + /// Gets a list of references to all virtual machines associated to the + /// capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.virtualMachinesAssociated")] + public IList VirtualMachinesAssociated { get; private set; } + + /// + /// Gets the capacity reservation group instance view which has the + /// list of instance views for all the capacity reservations that + /// belong to the capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public CapacityReservationGroupInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets availability Zones to use for this capacity + /// reservation group. The zones can be assigned only during creation. + /// If not provided, the group supports only regional resources in the + /// region. If provided, enforces each capacity reservation in the + /// group to be in one of the zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceView.cs new file mode 100644 index 000000000000..fc014db43cda --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceView.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CapacityReservationGroupInstanceView + { + /// + /// Initializes a new instance of the + /// CapacityReservationGroupInstanceView class. + /// + public CapacityReservationGroupInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CapacityReservationGroupInstanceView class. + /// + /// List of instance view of the + /// capacity reservations under the capacity reservation group. + public CapacityReservationGroupInstanceView(IList capacityReservations = default(IList)) + { + CapacityReservations = capacityReservations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of instance view of the capacity reservations under the + /// capacity reservation group. + /// + [JsonProperty(PropertyName = "capacityReservations")] + public IList CapacityReservations { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceViewTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceViewTypes.cs new file mode 100644 index 000000000000..9f03856bad53 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupInstanceViewTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for CapacityReservationGroupInstanceViewTypes. + /// + public static class CapacityReservationGroupInstanceViewTypes + { + public const string InstanceView = "instanceView"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupUpdate.cs new file mode 100644 index 000000000000..2e23935252dc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationGroupUpdate.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the capacity reservation group. Only tags + /// can be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class CapacityReservationGroupUpdate : UpdateResource + { + /// + /// Initializes a new instance of the CapacityReservationGroupUpdate + /// class. + /// + public CapacityReservationGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationGroupUpdate + /// class. + /// + /// Resource tags + /// A list of all capacity + /// reservation resource ids that belong to capacity reservation + /// group. + /// A list of references to all + /// virtual machines associated to the capacity reservation + /// group. + /// The capacity reservation group instance + /// view which has the list of instance views for all the capacity + /// reservations that belong to the capacity reservation group. + public CapacityReservationGroupUpdate(IDictionary tags = default(IDictionary), IList capacityReservations = default(IList), IList virtualMachinesAssociated = default(IList), CapacityReservationGroupInstanceView instanceView = default(CapacityReservationGroupInstanceView)) + : base(tags) + { + CapacityReservations = capacityReservations; + VirtualMachinesAssociated = virtualMachinesAssociated; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all capacity reservation resource ids that belong to + /// capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.capacityReservations")] + public IList CapacityReservations { get; private set; } + + /// + /// Gets a list of references to all virtual machines associated to the + /// capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.virtualMachinesAssociated")] + public IList VirtualMachinesAssociated { get; private set; } + + /// + /// Gets the capacity reservation group instance view which has the + /// list of instance views for all the capacity reservations that + /// belong to the capacity reservation group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public CapacityReservationGroupInstanceView InstanceView { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceView.cs new file mode 100644 index 000000000000..842469c5e675 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceView.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a capacity reservation that provides as snapshot + /// of the runtime properties of the capacity reservation that is managed + /// by the platform and can change outside of control plane operations. + /// + public partial class CapacityReservationInstanceView + { + /// + /// Initializes a new instance of the CapacityReservationInstanceView + /// class. + /// + public CapacityReservationInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationInstanceView + /// class. + /// + /// Unutilized capacity of the capacity + /// reservation. + /// The resource status information. + public CapacityReservationInstanceView(CapacityReservationUtilization utilizationInfo = default(CapacityReservationUtilization), IList statuses = default(IList)) + { + UtilizationInfo = utilizationInfo; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unutilized capacity of the capacity reservation. + /// + [JsonProperty(PropertyName = "utilizationInfo")] + public CapacityReservationUtilization UtilizationInfo { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewTypes.cs new file mode 100644 index 000000000000..49830fa1c2f4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for CapacityReservationInstanceViewTypes. + /// + public static class CapacityReservationInstanceViewTypes + { + public const string InstanceView = "instanceView"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewWithName.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewWithName.cs new file mode 100644 index 000000000000..68abbac33863 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationInstanceViewWithName.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a capacity reservation that includes the name of + /// the capacity reservation. It is used for the response to the instance + /// view of a capacity reservation group. + /// + public partial class CapacityReservationInstanceViewWithName : CapacityReservationInstanceView + { + /// + /// Initializes a new instance of the + /// CapacityReservationInstanceViewWithName class. + /// + public CapacityReservationInstanceViewWithName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CapacityReservationInstanceViewWithName class. + /// + /// Unutilized capacity of the capacity + /// reservation. + /// The resource status information. + /// The name of the capacity reservation. + public CapacityReservationInstanceViewWithName(CapacityReservationUtilization utilizationInfo = default(CapacityReservationUtilization), IList statuses = default(IList), string name = default(string)) + : base(utilizationInfo, statuses) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the capacity reservation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationProfile.cs new file mode 100644 index 000000000000..476b3e1cbd8d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationProfile.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters of a capacity reservation Profile. + /// + public partial class CapacityReservationProfile + { + /// + /// Initializes a new instance of the CapacityReservationProfile class. + /// + public CapacityReservationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationProfile class. + /// + /// Specifies the capacity + /// reservation group resource id that should be used for allocating + /// the virtual machine or scaleset vm instances provided enough + /// capacity has been reserved. Please refer to + /// https://aka.ms/CapacityReservation for more details. + public CapacityReservationProfile(SubResource capacityReservationGroup = default(SubResource)) + { + CapacityReservationGroup = capacityReservationGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the capacity reservation group resource id + /// that should be used for allocating the virtual machine or scaleset + /// vm instances provided enough capacity has been reserved. Please + /// refer to https://aka.ms/CapacityReservation for more details. + /// + [JsonProperty(PropertyName = "capacityReservationGroup")] + public SubResource CapacityReservationGroup { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUpdate.cs new file mode 100644 index 000000000000..7b4510301774 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUpdate.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the capacity reservation. Only tags and + /// sku.capacity can be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class CapacityReservationUpdate : UpdateResource + { + /// + /// Initializes a new instance of the CapacityReservationUpdate class. + /// + public CapacityReservationUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationUpdate class. + /// + /// Resource tags + /// A unique id generated and assigned to + /// the capacity reservation by the platform which does not change + /// throughout the lifetime of the resource. + /// Specifies the value of fault + /// domain count that Capacity Reservation supports for requested VM + /// size. **Note:** The fault domain count specified for a resource + /// (like virtual machines scale set) must be less than or equal to + /// this value if it deploys using capacity reservation. Minimum + /// api-version: 2022-08-01. + /// A list of all virtual + /// machine resource ids that are associated with the capacity + /// reservation. + /// The date time when the capacity + /// reservation was last updated. + /// The provisioning state, which only + /// appears in the response. + /// The Capacity reservation instance + /// view. + /// Specifies the time at which the Capacity + /// Reservation resource was created. Minimum api-version: + /// 2021-11-01. + /// SKU of the resource for which capacity needs be + /// reserved. The SKU name and capacity is required to be set. + /// Currently VM Skus with the capability called + /// 'CapacityReservationSupported' set to true are supported. Refer to + /// List Microsoft.Compute SKUs in a region + /// (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + /// supported values. + public CapacityReservationUpdate(IDictionary tags = default(IDictionary), string reservationId = default(string), int? platformFaultDomainCount = default(int?), IList virtualMachinesAssociated = default(IList), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), CapacityReservationInstanceView instanceView = default(CapacityReservationInstanceView), System.DateTime? timeCreated = default(System.DateTime?), Sku sku = default(Sku)) + : base(tags) + { + ReservationId = reservationId; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique id generated and assigned to the capacity reservation + /// by the platform which does not change throughout the lifetime of + /// the resource. + /// + [JsonProperty(PropertyName = "properties.reservationId")] + public string ReservationId { get; private set; } + + /// + /// Gets specifies the value of fault domain count that Capacity + /// Reservation supports for requested VM size. **Note:** The fault + /// domain count specified for a resource (like virtual machines scale + /// set) must be less than or equal to this value if it deploys using + /// capacity reservation. Minimum api-version: 2022-08-01. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; private set; } + + /// + /// Gets a list of all virtual machine resource ids that are associated + /// with the capacity reservation. + /// + [JsonProperty(PropertyName = "properties.virtualMachinesAssociated")] + public IList VirtualMachinesAssociated { get; private set; } + + /// + /// Gets the date time when the capacity reservation was last updated. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the Capacity reservation instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public CapacityReservationInstanceView InstanceView { get; private set; } + + /// + /// Gets specifies the time at which the Capacity Reservation resource + /// was created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets SKU of the resource for which capacity needs be + /// reserved. The SKU name and capacity is required to be set. + /// Currently VM Skus with the capability called + /// 'CapacityReservationSupported' set to true are supported. Refer to + /// List Microsoft.Compute SKUs in a region + /// (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + /// supported values. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUtilization.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUtilization.cs new file mode 100644 index 000000000000..f0304776451f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CapacityReservationUtilization.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents the capacity reservation utilization in terms of resources + /// allocated. + /// + public partial class CapacityReservationUtilization + { + /// + /// Initializes a new instance of the CapacityReservationUtilization + /// class. + /// + public CapacityReservationUtilization() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapacityReservationUtilization + /// class. + /// + /// The value provides the current + /// capacity of the VM size which was reserved successfully and for + /// which the customer is getting billed. Minimum api-version: + /// 2022-08-01. + /// A list of all virtual + /// machines resource ids allocated against the capacity + /// reservation. + public CapacityReservationUtilization(int? currentCapacity = default(int?), IList virtualMachinesAllocated = default(IList)) + { + CurrentCapacity = currentCapacity; + VirtualMachinesAllocated = virtualMachinesAllocated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the value provides the current capacity of the VM size which + /// was reserved successfully and for which the customer is getting + /// billed. Minimum api-version: 2022-08-01. + /// + [JsonProperty(PropertyName = "currentCapacity")] + public int? CurrentCapacity { get; private set; } + + /// + /// Gets a list of all virtual machines resource ids allocated against + /// the capacity reservation. + /// + [JsonProperty(PropertyName = "virtualMachinesAllocated")] + public IList VirtualMachinesAllocated { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudService.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudService.cs new file mode 100644 index 000000000000..eb81b080bd4c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudService.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the cloud service. + /// + public partial class CloudService : IResource + { + /// + /// Initializes a new instance of the CloudService class. + /// + public CloudService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudService class. + /// + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// List of logical availability zone of the + /// resource. List should contain only 1 zone where cloud service + /// should be provisioned. This field is optional. + public CloudService(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), CloudServiceProperties properties = default(CloudServiceProperties), SystemData systemData = default(SystemData), IList zones = default(IList)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Properties = properties; + SystemData = systemData; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Gets or sets list of logical availability zone of the resource. + /// List should contain only 1 zone where cloud service should be + /// provisioned. This field is optional. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProfile.cs new file mode 100644 index 000000000000..4458559f7cbc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProfile.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a cloud service extension profile. + /// + public partial class CloudServiceExtensionProfile + { + /// + /// Initializes a new instance of the CloudServiceExtensionProfile + /// class. + /// + public CloudServiceExtensionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceExtensionProfile + /// class. + /// + /// List of extensions for the cloud + /// service. + public CloudServiceExtensionProfile(IList extensions = default(IList)) + { + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of extensions for the cloud service. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProperties.cs new file mode 100644 index 000000000000..0b77cdb93eaf --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceExtensionProperties.cs @@ -0,0 +1,179 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Extension Properties. + /// + public partial class CloudServiceExtensionProperties + { + /// + /// Initializes a new instance of the CloudServiceExtensionProperties + /// class. + /// + public CloudServiceExtensionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceExtensionProperties + /// class. + /// + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension. + /// Specifies the version of the + /// extension. Specifies the version of the extension. If this element + /// is not specified or an asterisk (*) is used as the value, the + /// latest version of the extension is used. If the value is specified + /// with a major version number and an asterisk as the minor version + /// number (X.), the latest minor version of the specified major + /// version is selected. If a major version number and a minor version + /// number are specified (X.Y), the specific extension version is + /// selected. If a version is specified, an auto-upgrade is performed + /// on the role instance. + /// Explicitly specify whether + /// platform can automatically upgrade typeHandlerVersion to higher + /// minor versions when they become available. + /// Public settings for the extension. For JSON + /// extensions, this is the JSON settings for the extension. For XML + /// Extension (like RDP), this is the XML setting for the + /// extension. + /// Protected settings for the + /// extension which are encrypted before sent to the role + /// instance. + /// Tag to force apply the provided public + /// and protected settings. + /// Changing the tag value allows for re-running the extension without + /// changing any of the public or protected settings. + /// If forceUpdateTag is not changed, updates to public or protected + /// settings would still be applied by the handler. + /// If neither forceUpdateTag nor any of public or protected settings + /// change, extension would flow to the role instance with the same + /// sequence-number, and + /// it is up to handler implementation whether to re-run it or + /// not + /// The provisioning state, which only + /// appears in the response. + /// Optional list of roles to apply this + /// extension. If property is not specified or '*' is specified, + /// extension is applied to all roles in the cloud service. + public CloudServiceExtensionProperties(string publisher = default(string), string type = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), object settings = default(object), object protectedSettings = default(object), CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault = default(CloudServiceVaultAndSecretReference), string forceUpdateTag = default(string), string provisioningState = default(string), IList rolesAppliedTo = default(IList)) + { + Publisher = publisher; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + Settings = settings; + ProtectedSettings = protectedSettings; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + ForceUpdateTag = forceUpdateTag; + ProvisioningState = provisioningState; + RolesAppliedTo = rolesAppliedTo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the extension. Specifies the + /// version of the extension. If this element is not specified or an + /// asterisk (*) is used as the value, the latest version of the + /// extension is used. If the value is specified with a major version + /// number and an asterisk as the minor version number (X.), the latest + /// minor version of the specified major version is selected. If a + /// major version number and a minor version number are specified + /// (X.Y), the specific extension version is selected. If a version is + /// specified, an auto-upgrade is performed on the role instance. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets explicitly specify whether platform can automatically + /// upgrade typeHandlerVersion to higher minor versions when they + /// become available. + /// + [JsonProperty(PropertyName = "autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets public settings for the extension. For JSON + /// extensions, this is the JSON settings for the extension. For XML + /// Extension (like RDP), this is the XML setting for the extension. + /// + [JsonProperty(PropertyName = "settings")] + public object Settings { get; set; } + + /// + /// Gets or sets protected settings for the extension which are + /// encrypted before sent to the role instance. + /// + [JsonProperty(PropertyName = "protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// + [JsonProperty(PropertyName = "protectedSettingsFromKeyVault")] + public CloudServiceVaultAndSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Gets or sets tag to force apply the provided public and protected + /// settings. + /// Changing the tag value allows for re-running the extension without + /// changing any of the public or protected settings. + /// If forceUpdateTag is not changed, updates to public or protected + /// settings would still be applied by the handler. + /// If neither forceUpdateTag nor any of public or protected settings + /// change, extension would flow to the role instance with the same + /// sequence-number, and + /// it is up to handler implementation whether to re-run it or not + /// + [JsonProperty(PropertyName = "forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets optional list of roles to apply this extension. If + /// property is not specified or '*' is specified, extension is applied + /// to all roles in the cloud service. + /// + [JsonProperty(PropertyName = "rolesAppliedTo")] + public IList RolesAppliedTo { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceInstanceView.cs new file mode 100644 index 000000000000..8aec884b94ef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceInstanceView.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// InstanceView of CloudService as a whole + /// + public partial class CloudServiceInstanceView + { + /// + /// Initializes a new instance of the CloudServiceInstanceView class. + /// + public CloudServiceInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceInstanceView class. + /// + /// The version of the SDK that was used to + /// generate the package for the cloud service. + /// Specifies a list of unique identifiers + /// generated internally for the cloud service. <br /><br + /// /> NOTE: If you are using Azure Diagnostics extension, this + /// property can be used as 'DeploymentId' for querying + /// details. + public CloudServiceInstanceView(InstanceViewStatusesSummary roleInstance = default(InstanceViewStatusesSummary), string sdkVersion = default(string), IList privateIds = default(IList), IList statuses = default(IList)) + { + RoleInstance = roleInstance; + SdkVersion = sdkVersion; + PrivateIds = privateIds; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "roleInstance")] + public InstanceViewStatusesSummary RoleInstance { get; set; } + + /// + /// Gets the version of the SDK that was used to generate the package + /// for the cloud service. + /// + [JsonProperty(PropertyName = "sdkVersion")] + public string SdkVersion { get; private set; } + + /// + /// Gets specifies a list of unique identifiers generated internally + /// for the cloud service. &lt;br /&gt;&lt;br /&gt; + /// NOTE: If you are using Azure Diagnostics extension, this property + /// can be used as 'DeploymentId' for querying details. + /// + [JsonProperty(PropertyName = "privateIds")] + public IList PrivateIds { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceNetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceNetworkProfile.cs new file mode 100644 index 000000000000..2e4e4607d809 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceNetworkProfile.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Network Profile for the cloud service. + /// + public partial class CloudServiceNetworkProfile + { + /// + /// Initializes a new instance of the CloudServiceNetworkProfile class. + /// + public CloudServiceNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceNetworkProfile class. + /// + /// List of Load balancer + /// configurations. Cloud service can have up to two load balancer + /// configurations, corresponding to a Public Load Balancer and an + /// Internal Load Balancer. + /// Possible values include: 'Production', + /// 'Staging' + /// The id reference of the cloud + /// service containing the target IP with which the subject cloud + /// service can perform a swap. This property cannot be updated once it + /// is set. The swappable cloud service referred by this id must be + /// present otherwise an error will be thrown. + public CloudServiceNetworkProfile(IList loadBalancerConfigurations = default(IList), string slotType = default(string), SubResource swappableCloudService = default(SubResource)) + { + LoadBalancerConfigurations = loadBalancerConfigurations; + SlotType = slotType; + SwappableCloudService = swappableCloudService; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Load balancer configurations. Cloud service + /// can have up to two load balancer configurations, corresponding to a + /// Public Load Balancer and an Internal Load Balancer. + /// + [JsonProperty(PropertyName = "loadBalancerConfigurations")] + public IList LoadBalancerConfigurations { get; set; } + + /// + /// Gets or sets possible values include: 'Production', 'Staging' + /// + [JsonProperty(PropertyName = "slotType")] + public string SlotType { get; set; } + + /// + /// Gets or sets the id reference of the cloud service containing the + /// target IP with which the subject cloud service can perform a swap. + /// This property cannot be updated once it is set. The swappable cloud + /// service referred by this id must be present otherwise an error will + /// be thrown. + /// + [JsonProperty(PropertyName = "swappableCloudService")] + public SubResource SwappableCloudService { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceOsProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceOsProfile.cs new file mode 100644 index 000000000000..012e60e27a47 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceOsProfile.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the OS profile for the cloud service. + /// + public partial class CloudServiceOsProfile + { + /// + /// Initializes a new instance of the CloudServiceOsProfile class. + /// + public CloudServiceOsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceOsProfile class. + /// + /// Specifies set of certificates that should be + /// installed onto the role instances. + public CloudServiceOsProfile(IList secrets = default(IList)) + { + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the role instances. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceProperties.cs new file mode 100644 index 000000000000..487ee426d013 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceProperties.cs @@ -0,0 +1,173 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Cloud service properties + /// + public partial class CloudServiceProperties + { + /// + /// Initializes a new instance of the CloudServiceProperties class. + /// + public CloudServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceProperties class. + /// + /// Specifies a URL that refers to the + /// location of the service package in the Blob service. The service + /// package URL can be Shared Access Signature (SAS) URI from any + /// storage account. + /// This is a write-only property and is not returned in GET + /// calls. + /// Specifies the XML service configuration + /// (.cscfg) for the cloud service. + /// Specifies a URL that refers to the + /// location of the service configuration in the Blob service. The + /// service package URL can be Shared Access Signature (SAS) URI from + /// any storage account. + /// This is a write-only property and is not returned in GET + /// calls. + /// (Optional) Indicates whether to + /// start the cloud service immediately after it is created. The + /// default value is `true`. + /// If false, the service model is still deployed, but the code is not + /// run immediately. Instead, the service is PoweredOff until you call + /// Start, at which time the service will be started. A deployed + /// service still incurs charges, even if it is poweredoff. + /// (Optional) Indicates whether the + /// role sku properties (roleProfile.roles.sku) specified in the + /// model/template should override the role instance count and vm size + /// specified in the .cscfg and .csdef respectively. + /// The default value is `false`. + /// Possible values include: 'Auto', + /// 'Manual', 'Simultaneous' + /// The provisioning state, which only + /// appears in the response. + /// The unique identifier for the cloud + /// service. + public CloudServiceProperties(string packageUrl = default(string), string configuration = default(string), string configurationUrl = default(string), bool? startCloudService = default(bool?), bool? allowModelOverride = default(bool?), string upgradeMode = default(string), CloudServiceRoleProfile roleProfile = default(CloudServiceRoleProfile), CloudServiceOsProfile osProfile = default(CloudServiceOsProfile), CloudServiceNetworkProfile networkProfile = default(CloudServiceNetworkProfile), CloudServiceExtensionProfile extensionProfile = default(CloudServiceExtensionProfile), string provisioningState = default(string), string uniqueId = default(string)) + { + PackageUrl = packageUrl; + Configuration = configuration; + ConfigurationUrl = configurationUrl; + StartCloudService = startCloudService; + AllowModelOverride = allowModelOverride; + UpgradeMode = upgradeMode; + RoleProfile = roleProfile; + OsProfile = osProfile; + NetworkProfile = networkProfile; + ExtensionProfile = extensionProfile; + ProvisioningState = provisioningState; + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies a URL that refers to the location of the + /// service package in the Blob service. The service package URL can be + /// Shared Access Signature (SAS) URI from any storage account. + /// This is a write-only property and is not returned in GET calls. + /// + [JsonProperty(PropertyName = "packageUrl")] + public string PackageUrl { get; set; } + + /// + /// Gets or sets specifies the XML service configuration (.cscfg) for + /// the cloud service. + /// + [JsonProperty(PropertyName = "configuration")] + public string Configuration { get; set; } + + /// + /// Gets or sets specifies a URL that refers to the location of the + /// service configuration in the Blob service. The service package URL + /// can be Shared Access Signature (SAS) URI from any storage account. + /// This is a write-only property and is not returned in GET calls. + /// + [JsonProperty(PropertyName = "configurationUrl")] + public string ConfigurationUrl { get; set; } + + /// + /// Gets or sets (Optional) Indicates whether to start the cloud + /// service immediately after it is created. The default value is + /// `true`. + /// If false, the service model is still deployed, but the code is not + /// run immediately. Instead, the service is PoweredOff until you call + /// Start, at which time the service will be started. A deployed + /// service still incurs charges, even if it is poweredoff. + /// + [JsonProperty(PropertyName = "startCloudService")] + public bool? StartCloudService { get; set; } + + /// + /// Gets or sets (Optional) Indicates whether the role sku properties + /// (roleProfile.roles.sku) specified in the model/template should + /// override the role instance count and vm size specified in the + /// .cscfg and .csdef respectively. + /// The default value is `false`. + /// + [JsonProperty(PropertyName = "allowModelOverride")] + public bool? AllowModelOverride { get; set; } + + /// + /// Gets or sets possible values include: 'Auto', 'Manual', + /// 'Simultaneous' + /// + [JsonProperty(PropertyName = "upgradeMode")] + public string UpgradeMode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "roleProfile")] + public CloudServiceRoleProfile RoleProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "osProfile")] + public CloudServiceOsProfile OsProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "networkProfile")] + public CloudServiceNetworkProfile NetworkProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extensionProfile")] + public CloudServiceExtensionProfile ExtensionProfile { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique identifier for the cloud service. + /// + [JsonProperty(PropertyName = "uniqueId")] + public string UniqueId { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRole.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRole.cs new file mode 100644 index 000000000000..ed30d6cb8090 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRole.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a role of the cloud service. + /// + public partial class CloudServiceRole + { + /// + /// Initializes a new instance of the CloudServiceRole class. + /// + public CloudServiceRole() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRole class. + /// + /// Resource id + /// Resource name + /// Resource type + /// Resource location + public CloudServiceRole(string id = default(string), string name = default(string), string type = default(string), string location = default(string), CloudServiceRoleSku sku = default(CloudServiceRoleSku), CloudServiceRoleProperties properties = default(CloudServiceRoleProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Sku = sku; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public CloudServiceRoleSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceRoleProperties Properties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfile.cs new file mode 100644 index 000000000000..6ec87974a474 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfile.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the role profile for the cloud service. + /// + public partial class CloudServiceRoleProfile + { + /// + /// Initializes a new instance of the CloudServiceRoleProfile class. + /// + public CloudServiceRoleProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProfile class. + /// + /// List of roles for the cloud service. + public CloudServiceRoleProfile(IList roles = default(IList)) + { + Roles = roles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of roles for the cloud service. + /// + [JsonProperty(PropertyName = "roles")] + public IList Roles { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfileProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfileProperties.cs new file mode 100644 index 000000000000..47db1e0408aa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProfileProperties.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the role properties. + /// + public partial class CloudServiceRoleProfileProperties + { + /// + /// Initializes a new instance of the CloudServiceRoleProfileProperties + /// class. + /// + public CloudServiceRoleProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProfileProperties + /// class. + /// + /// Resource name. + public CloudServiceRoleProfileProperties(string name = default(string), CloudServiceRoleSku sku = default(CloudServiceRoleSku)) + { + Name = name; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public CloudServiceRoleSku Sku { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProperties.cs new file mode 100644 index 000000000000..d7c28624b0d9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleProperties.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The cloud service role properties. + /// + public partial class CloudServiceRoleProperties + { + /// + /// Initializes a new instance of the CloudServiceRoleProperties class. + /// + public CloudServiceRoleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleProperties class. + /// + /// Specifies the ID which uniquely identifies a + /// cloud service role. + public CloudServiceRoleProperties(string uniqueId = default(string)) + { + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the ID which uniquely identifies a cloud service + /// role. + /// + [JsonProperty(PropertyName = "uniqueId")] + public string UniqueId { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleSku.cs new file mode 100644 index 000000000000..b0bbae8e08a5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceRoleSku.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the cloud service role sku. + /// + public partial class CloudServiceRoleSku + { + /// + /// Initializes a new instance of the CloudServiceRoleSku class. + /// + public CloudServiceRoleSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceRoleSku class. + /// + /// The sku name. NOTE: If the new SKU is not + /// supported on the hardware the cloud service is currently on, you + /// need to delete and recreate the cloud service or move back to the + /// old sku. + /// Specifies the tier of the cloud service. + /// Possible Values are <br /><br /> **Standard** <br + /// /><br /> **Basic** + /// Specifies the number of role instances in + /// the cloud service. + public CloudServiceRoleSku(string name = default(string), string tier = default(string), long? capacity = default(long?)) + { + Name = name; + Tier = tier; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku name. NOTE: If the new SKU is not supported on + /// the hardware the cloud service is currently on, you need to delete + /// and recreate the cloud service or move back to the old sku. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the tier of the cloud service. Possible + /// Values are &lt;br /&gt;&lt;br /&gt; **Standard** + /// &lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets specifies the number of role instances in the cloud + /// service. + /// + [JsonProperty(PropertyName = "capacity")] + public long? Capacity { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceSlotType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceSlotType.cs new file mode 100644 index 000000000000..c6254132936e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceSlotType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for CloudServiceSlotType. + /// + public static class CloudServiceSlotType + { + public const string Production = "Production"; + public const string Staging = "Staging"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpdate.cs new file mode 100644 index 000000000000..6d1c6f76be04 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpdate.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CloudServiceUpdate + { + /// + /// Initializes a new instance of the CloudServiceUpdate class. + /// + public CloudServiceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceUpdate class. + /// + /// Resource tags + public CloudServiceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpgradeMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpgradeMode.cs new file mode 100644 index 000000000000..6d25f3f7cd7d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceUpgradeMode.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for CloudServiceUpgradeMode. + /// + public static class CloudServiceUpgradeMode + { + public const string Auto = "Auto"; + public const string Manual = "Manual"; + public const string Simultaneous = "Simultaneous"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultAndSecretReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultAndSecretReference.cs new file mode 100644 index 000000000000..432c3e8bac84 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultAndSecretReference.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Protected settings for the extension, referenced using KeyVault which + /// are encrypted before sent to the role instance. + /// + public partial class CloudServiceVaultAndSecretReference + { + /// + /// Initializes a new instance of the + /// CloudServiceVaultAndSecretReference class. + /// + public CloudServiceVaultAndSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CloudServiceVaultAndSecretReference class. + /// + /// The ARM Resource ID of the Key + /// Vault + /// Secret URL which contains the protected + /// settings of the extension + public CloudServiceVaultAndSecretReference(SubResource sourceVault = default(SubResource), string secretUrl = default(string)) + { + SourceVault = sourceVault; + SecretUrl = secretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ARM Resource ID of the Key Vault + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Gets or sets secret URL which contains the protected settings of + /// the extension + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultCertificate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultCertificate.cs new file mode 100644 index 000000000000..d5643600aa3c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultCertificate.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a single certificate reference in a Key Vault, and where the + /// certificate should reside on the role instance. + /// + public partial class CloudServiceVaultCertificate + { + /// + /// Initializes a new instance of the CloudServiceVaultCertificate + /// class. + /// + public CloudServiceVaultCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceVaultCertificate + /// class. + /// + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. + public CloudServiceVaultCertificate(string certificateUrl = default(string)) + { + CertificateUrl = certificateUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultSecretGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultSecretGroup.cs new file mode 100644 index 000000000000..38b9d2224c25 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CloudServiceVaultSecretGroup.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a set of certificates which are all in the same Key Vault. + /// + public partial class CloudServiceVaultSecretGroup + { + /// + /// Initializes a new instance of the CloudServiceVaultSecretGroup + /// class. + /// + public CloudServiceVaultSecretGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceVaultSecretGroup + /// class. + /// + /// The relative URL of the Key Vault + /// containing all of the certificates in VaultCertificates. + /// The list of key vault references in + /// SourceVault which contain certificates. + public CloudServiceVaultSecretGroup(SubResource sourceVault = default(SubResource), IList vaultCertificates = default(IList)) + { + SourceVault = sourceVault; + VaultCertificates = vaultCertificates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the relative URL of the Key Vault containing all of + /// the certificates in VaultCertificates. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Gets or sets the list of key vault references in SourceVault which + /// contain certificates. + /// + [JsonProperty(PropertyName = "vaultCertificates")] + public IList VaultCertificates { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGallery.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGallery.cs new file mode 100644 index 000000000000..a3825c10e60c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGallery.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// Specifies information about the Community Gallery that you want to + /// create or update. + /// + public partial class CommunityGallery : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGallery class. + /// + public CommunityGallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGallery class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + public CommunityGallery(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string)) + : base(name, location, type, uniqueId) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImage.cs new file mode 100644 index 000000000000..a02cacfd39c2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImage.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class CommunityGalleryImage : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGalleryImage class. + /// + public CommunityGalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryImage class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// A list of gallery image features. + /// Possible values include: 'x64', + /// 'Arm64' + /// Privacy statement uri for the + /// current community gallery image. + /// End-user license agreement for the current + /// community gallery image. + public CommunityGalleryImage(OperatingSystemTypes osType, OperatingSystemStateTypes osState, CommunityGalleryImageIdentifier identifier, string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), string hyperVGeneration = default(string), IList features = default(IList), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string architecture = default(string), string privacyStatementUri = default(string), string eula = default(string)) + : base(name, location, type, uniqueId) + { + OsType = osType; + OsState = osState; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + HyperVGeneration = hyperVGeneration; + Features = features; + PurchasePlan = purchasePlan; + Architecture = architecture; + PrivacyStatementUri = privacyStatementUri; + Eula = eula; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public CommunityGalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets possible values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "properties.architecture")] + public string Architecture { get; set; } + + /// + /// Gets or sets privacy statement uri for the current community + /// gallery image. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets end-user license agreement for the current community + /// gallery image. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageIdentifier.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageIdentifier.cs new file mode 100644 index 000000000000..b828fbf38627 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageIdentifier.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the community gallery image definition identifier. + /// + public partial class CommunityGalleryImageIdentifier + { + /// + /// Initializes a new instance of the CommunityGalleryImageIdentifier + /// class. + /// + public CommunityGalleryImageIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryImageIdentifier + /// class. + /// + /// The name of the gallery image definition + /// publisher. + /// The name of the gallery image definition + /// offer. + /// The name of the gallery image definition + /// SKU. + public CommunityGalleryImageIdentifier(string publisher = default(string), string offer = default(string), string sku = default(string)) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the gallery image definition publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the name of the gallery image definition offer. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the name of the gallery image definition SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageVersion.cs new file mode 100644 index 000000000000..0829d3a39889 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryImageVersion.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class CommunityGalleryImageVersion : PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the CommunityGalleryImageVersion + /// class. + /// + public CommunityGalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryImageVersion + /// class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + /// The published date of the gallery image + /// version Definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The end of life date of the gallery + /// image version Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + /// If set to true, Virtual Machines + /// deployed from the latest version of the Image Definition won't use + /// this Image Version. + /// Describes the storage profile of the + /// image version. + public CommunityGalleryImageVersion(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), bool? excludeFromLatest = default(bool?), SharedGalleryImageVersionStorageProfile storageProfile = default(SharedGalleryImageVersionStorageProfile)) + : base(name, location, type, uniqueId) + { + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + ExcludeFromLatest = excludeFromLatest; + StorageProfile = storageProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the published date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.publishedDate")] + public System.DateTime? PublishedDate { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets if set to true, Virtual Machines deployed from the + /// latest version of the Image Definition won't use this Image + /// Version. + /// + [JsonProperty(PropertyName = "properties.excludeFromLatest")] + public bool? ExcludeFromLatest { get; set; } + + /// + /// Gets or sets describes the storage profile of the image version. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public SharedGalleryImageVersionStorageProfile StorageProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryInfo.cs new file mode 100644 index 000000000000..ec47ca47d6c2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CommunityGalleryInfo.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information of community gallery if current gallery is shared to + /// community + /// + public partial class CommunityGalleryInfo + { + /// + /// Initializes a new instance of the CommunityGalleryInfo class. + /// + public CommunityGalleryInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommunityGalleryInfo class. + /// + /// The link to the publisher website. + /// Visible to all users. + /// Community gallery publisher support + /// email. The email address of the publisher. Visible to all + /// users. + /// End-user license agreement for community gallery + /// image. + /// The prefix of the gallery name that + /// will be displayed publicly. Visible to all users. + /// Contains info about whether + /// community gallery sharing is enabled. + /// Community gallery public name + /// list. + public CommunityGalleryInfo(string publisherUri = default(string), string publisherContact = default(string), string eula = default(string), string publicNamePrefix = default(string), bool? communityGalleryEnabled = default(bool?), IList publicNames = default(IList)) + { + PublisherUri = publisherUri; + PublisherContact = publisherContact; + Eula = eula; + PublicNamePrefix = publicNamePrefix; + CommunityGalleryEnabled = communityGalleryEnabled; + PublicNames = publicNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the link to the publisher website. Visible to all + /// users. + /// + [JsonProperty(PropertyName = "publisherUri")] + public string PublisherUri { get; set; } + + /// + /// Gets or sets community gallery publisher support email. The email + /// address of the publisher. Visible to all users. + /// + [JsonProperty(PropertyName = "publisherContact")] + public string PublisherContact { get; set; } + + /// + /// Gets or sets end-user license agreement for community gallery + /// image. + /// + [JsonProperty(PropertyName = "eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the prefix of the gallery name that will be displayed + /// publicly. Visible to all users. + /// + [JsonProperty(PropertyName = "publicNamePrefix")] + public string PublicNamePrefix { get; set; } + + /// + /// Gets contains info about whether community gallery sharing is + /// enabled. + /// + [JsonProperty(PropertyName = "communityGalleryEnabled")] + public bool? CommunityGalleryEnabled { get; private set; } + + /// + /// Gets community gallery public name list. + /// + [JsonProperty(PropertyName = "publicNames")] + public IList PublicNames { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ComponentNames.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ComponentNames.cs new file mode 100644 index 000000000000..fa005a8109a2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ComponentNames.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ComponentNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ComponentNames + { + [EnumMember(Value = "Microsoft-Windows-Shell-Setup")] + MicrosoftWindowsShellSetup + } + internal static class ComponentNamesEnumExtension + { + internal static string ToSerializedValue(this ComponentNames? value) + { + return value == null ? null : ((ComponentNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ComponentNames value) + { + switch( value ) + { + case ComponentNames.MicrosoftWindowsShellSetup: + return "Microsoft-Windows-Shell-Setup"; + } + return null; + } + + internal static ComponentNames? ParseComponentNames(this string value) + { + switch( value ) + { + case "Microsoft-Windows-Shell-Setup": + return ComponentNames.MicrosoftWindowsShellSetup; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ComputeOperationValue.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ComputeOperationValue.cs new file mode 100644 index 000000000000..56229fc0bdf1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ComputeOperationValue.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a Compute Operation value. + /// + [Rest.Serialization.JsonTransformation] + public partial class ComputeOperationValue + { + /// + /// Initializes a new instance of the ComputeOperationValue class. + /// + public ComputeOperationValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeOperationValue class. + /// + /// The origin of the compute operation. + /// The name of the compute operation. + /// The display name of the compute + /// operation. + /// The display name of the resource the + /// operation applies to. + /// The description of the operation. + /// The resource provider for the + /// operation. + public ComputeOperationValue(string origin = default(string), string name = default(string), string operation = default(string), string resource = default(string), string description = default(string), string provider = default(string)) + { + Origin = origin; + Name = name; + Operation = operation; + Resource = resource; + Description = description; + Provider = provider; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the origin of the compute operation. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets the name of the compute operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the display name of the compute operation. + /// + [JsonProperty(PropertyName = "display.operation")] + public string Operation { get; private set; } + + /// + /// Gets the display name of the resource the operation applies to. + /// + [JsonProperty(PropertyName = "display.resource")] + public string Resource { get; private set; } + + /// + /// Gets the description of the operation. + /// + [JsonProperty(PropertyName = "display.description")] + public string Description { get; private set; } + + /// + /// Gets the resource provider for the operation. + /// + [JsonProperty(PropertyName = "display.provider")] + public string Provider { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ConfidentialVMEncryptionType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ConfidentialVMEncryptionType.cs new file mode 100644 index 000000000000..77860c8d36af --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ConfidentialVMEncryptionType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ConfidentialVMEncryptionType. + /// + public static class ConfidentialVMEncryptionType + { + public const string EncryptedVMGuestStateOnlyWithPmk = "EncryptedVMGuestStateOnlyWithPmk"; + public const string EncryptedWithPmk = "EncryptedWithPmk"; + public const string EncryptedWithCmk = "EncryptedWithCmk"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ConsistencyModeTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ConsistencyModeTypes.cs new file mode 100644 index 000000000000..d00df066e779 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ConsistencyModeTypes.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ConsistencyModeTypes. + /// + public static class ConsistencyModeTypes + { + public const string CrashConsistent = "CrashConsistent"; + public const string FileSystemConsistent = "FileSystemConsistent"; + public const string ApplicationConsistent = "ApplicationConsistent"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CopyCompletionError.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CopyCompletionError.cs new file mode 100644 index 000000000000..1f445732ceec --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CopyCompletionError.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Indicates the error details if the background copy of a resource + /// created via the CopyStart operation fails. + /// + public partial class CopyCompletionError + { + /// + /// Initializes a new instance of the CopyCompletionError class. + /// + public CopyCompletionError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CopyCompletionError class. + /// + /// Indicates the error message if the + /// background copy of a resource created via the CopyStart operation + /// fails. + public CopyCompletionError(string errorMessage) + { + ErrorMessage = errorMessage; + CustomInit(); + } + /// + /// Static constructor for CopyCompletionError class. + /// + static CopyCompletionError() + { + ErrorCode = "CopySourceNotFound"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates the error message if the background copy of + /// a resource created via the CopyStart operation fails. + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// Indicates the error code if the background copy of a resource + /// created via the CopyStart operation fails. + /// + [JsonProperty(PropertyName = "errorCode")] + public static string ErrorCode { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ErrorMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ErrorMessage"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/CreationData.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/CreationData.cs new file mode 100644 index 000000000000..78793109822e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/CreationData.cs @@ -0,0 +1,198 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data used when creating a disk. + /// + public partial class CreationData + { + /// + /// Initializes a new instance of the CreationData class. + /// + public CreationData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreationData class. + /// + /// This enumerates the possible sources of + /// a disk's creation. Possible values include: 'Empty', 'Attach', + /// 'FromImage', 'Import', 'Copy', 'Restore', 'Upload', 'CopyStart', + /// 'ImportSecure', 'UploadPreparedSecure', + /// 'CopyFromSanSnapshot' + /// Required if createOption is Import. + /// The Azure Resource Manager identifier of the storage account + /// containing the blob to import as a disk. + /// Disk source information for PIR or + /// user images. + /// Required if creating from a + /// Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId + /// of the ImageDiskReference will be the ARM id of the shared galley + /// image version from which to create a disk. + /// If createOption is Import, this is the URI + /// of a blob to be imported into a managed disk. + /// If createOption is Copy, this is the + /// ARM id of the source snapshot or disk. + /// If this field is set, this is the + /// unique id identifying the source of this resource. + /// If createOption is Upload, this is + /// the size of the contents of the upload including the VHD footer. + /// This value should be between 20972032 (20 MiB + 512 bytes for the + /// VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the + /// VHD footer). + /// Logical sector size in bytes for + /// Ultra disks. Supported values are 512 ad 4096. 4096 is the + /// default. + /// If createOption is ImportSecure, this + /// is the URI of a blob to be imported into VM guest state. + /// Set this flag to true to get a boost + /// on the performance target of the disk deployed, see here on the + /// respective performance target. This flag can only be set on disk + /// creation time and cannot be disabled after enabled. + /// Required if createOption is + /// CopyFromSanSnapshot. This is the ARM id of the source elastic san + /// volume snapshot. + public CreationData(string createOption, string storageAccountId = default(string), ImageDiskReference imageReference = default(ImageDiskReference), ImageDiskReference galleryImageReference = default(ImageDiskReference), string sourceUri = default(string), string sourceResourceId = default(string), string sourceUniqueId = default(string), long? uploadSizeBytes = default(long?), int? logicalSectorSize = default(int?), string securityDataUri = default(string), bool? performancePlus = default(bool?), string elasticSanResourceId = default(string)) + { + CreateOption = createOption; + StorageAccountId = storageAccountId; + ImageReference = imageReference; + GalleryImageReference = galleryImageReference; + SourceUri = sourceUri; + SourceResourceId = sourceResourceId; + SourceUniqueId = sourceUniqueId; + UploadSizeBytes = uploadSizeBytes; + LogicalSectorSize = logicalSectorSize; + SecurityDataUri = securityDataUri; + PerformancePlus = performancePlus; + ElasticSanResourceId = elasticSanResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this enumerates the possible sources of a disk's + /// creation. Possible values include: 'Empty', 'Attach', 'FromImage', + /// 'Import', 'Copy', 'Restore', 'Upload', 'CopyStart', 'ImportSecure', + /// 'UploadPreparedSecure', 'CopyFromSanSnapshot' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets required if createOption is Import. The Azure Resource + /// Manager identifier of the storage account containing the blob to + /// import as a disk. + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { get; set; } + + /// + /// Gets or sets disk source information for PIR or user images. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageDiskReference ImageReference { get; set; } + + /// + /// Gets or sets required if creating from a Gallery Image. The + /// id/sharedGalleryImageId/communityGalleryImageId of the + /// ImageDiskReference will be the ARM id of the shared galley image + /// version from which to create a disk. + /// + [JsonProperty(PropertyName = "galleryImageReference")] + public ImageDiskReference GalleryImageReference { get; set; } + + /// + /// Gets or sets if createOption is Import, this is the URI of a blob + /// to be imported into a managed disk. + /// + [JsonProperty(PropertyName = "sourceUri")] + public string SourceUri { get; set; } + + /// + /// Gets or sets if createOption is Copy, this is the ARM id of the + /// source snapshot or disk. + /// + [JsonProperty(PropertyName = "sourceResourceId")] + public string SourceResourceId { get; set; } + + /// + /// Gets if this field is set, this is the unique id identifying the + /// source of this resource. + /// + [JsonProperty(PropertyName = "sourceUniqueId")] + public string SourceUniqueId { get; private set; } + + /// + /// Gets or sets if createOption is Upload, this is the size of the + /// contents of the upload including the VHD footer. This value should + /// be between 20972032 (20 MiB + 512 bytes for the VHD footer) and + /// 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + /// + [JsonProperty(PropertyName = "uploadSizeBytes")] + public long? UploadSizeBytes { get; set; } + + /// + /// Gets or sets logical sector size in bytes for Ultra disks. + /// Supported values are 512 ad 4096. 4096 is the default. + /// + [JsonProperty(PropertyName = "logicalSectorSize")] + public int? LogicalSectorSize { get; set; } + + /// + /// Gets or sets if createOption is ImportSecure, this is the URI of a + /// blob to be imported into VM guest state. + /// + [JsonProperty(PropertyName = "securityDataUri")] + public string SecurityDataUri { get; set; } + + /// + /// Gets or sets set this flag to true to get a boost on the + /// performance target of the disk deployed, see here on the respective + /// performance target. This flag can only be set on disk creation time + /// and cannot be disabled after enabled. + /// + [JsonProperty(PropertyName = "performancePlus")] + public bool? PerformancePlus { get; set; } + + /// + /// Gets or sets required if createOption is CopyFromSanSnapshot. This + /// is the ARM id of the source elastic san volume snapshot. + /// + [JsonProperty(PropertyName = "elasticSanResourceId")] + public string ElasticSanResourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DataAccessAuthMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DataAccessAuthMode.cs new file mode 100644 index 000000000000..8c7876ce51ba --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DataAccessAuthMode.cs @@ -0,0 +1,31 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DataAccessAuthMode. + /// + public static class DataAccessAuthMode + { + /// + /// When export/upload URL is used, the system checks if the user has + /// an identity in Azure Active Directory and has necessary permissions + /// to export/upload the data. Please refer to aka.ms/DisksAzureADAuth. + /// + public const string AzureActiveDirectory = "AzureActiveDirectory"; + /// + /// No additional authentication would be performed when accessing + /// export/upload URL. + /// + public const string None = "None"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DataDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDisk.cs new file mode 100644 index 000000000000..dc9186f246b6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDisk.cs @@ -0,0 +1,263 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a data disk. + /// + public partial class DataDisk + { + /// + /// Initializes a new instance of the DataDisk class. + /// + public DataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDisk class. + /// + /// 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. + /// Specifies how the virtual machine should + /// be created. Possible values are: **Attach.** This value is used + /// when you are using a specialized disk to create the virtual + /// machine. **FromImage.** This value is used when you are using an + /// image to create the virtual machine. If you are using a platform + /// image, you should also use the imageReference element described + /// above. If you are using a marketplace image, you should also use + /// the plan element previously described. Possible values include: + /// 'FromImage', 'Empty', 'Attach' + /// The disk name. + /// The virtual hard disk. + /// 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. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The defaulting + /// behavior is: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. The property 'diskSizeGB' is the + /// number of bytes x 1024^3 for the disk and the value cannot be + /// larger than 1023. + /// The managed disk parameters. + /// Specifies whether the data disk is in + /// process of detachment from the + /// VirtualMachine/VirtualMachineScaleset + /// Specifies the Read-Write IOPS for + /// the managed disk when StorageAccountType is UltraSSD_LRS. Returned + /// only for VirtualMachine ScaleSet VM disks. Can be updated only via + /// updates to the VirtualMachine Scale Set. + /// Specifies the bandwidth in MB per + /// second for the managed disk when StorageAccountType is + /// UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. + /// Can be updated only via updates to the VirtualMachine Scale + /// Set. + /// Specifies the detach behavior to be used + /// while detaching a disk or which is already in the process of + /// detachment from the virtual machine. Supported values: + /// **ForceDetach.** detachOption: **ForceDetach** is applicable only + /// for managed data disks. If a previous detachment attempt of the + /// data disk did not complete due to an unexpected failure from the + /// virtual machine and the disk is still not released then use + /// force-detach as a last resort option to detach the disk forcibly + /// from the VM. All writes might not have been flushed when using this + /// detach behavior. **This feature is still in preview** mode and is + /// not supported for VirtualMachineScaleSet. To force-detach a data + /// disk update toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' + /// Specifies whether data disk should be + /// deleted or detached upon VM deletion. Possible values are: + /// **Delete.** If this value is used, the data disk is deleted when VM + /// is deleted. **Detach.** If this value is used, the data disk is + /// retained after VM is deleted. The default value is set to + /// **Detach**. Possible values include: 'Delete', 'Detach' + public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), string detachOption = default(string), string deleteOption = default(string)) + { + Lun = lun; + Name = name; + Vhd = vhd; + Image = image; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + ToBeDetached = toBeDetached; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DetachOption = detachOption; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the virtual hard disk. + /// + [JsonProperty(PropertyName = "vhd")] + public VirtualHardDisk Vhd { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the caching requirements. Possible values + /// are: **None,** **ReadOnly,** **ReadWrite.** The defaulting behavior + /// is: **None for Standard storage. ReadOnly for Premium storage.**. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies how the virtual machine should be created. + /// Possible values are: **Attach.** This value is used when you are + /// using a specialized disk to create the virtual machine. + /// **FromImage.** This value is used when you are using an image to + /// create the virtual machine. If you are using a platform image, you + /// should also use the imageReference element described above. If you + /// are using a marketplace image, you should also use the plan element + /// previously described. Possible values include: 'FromImage', + /// 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. The property 'diskSizeGB' is the number of + /// bytes x 1024^3 for the disk and the value cannot be larger than + /// 1023. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies whether the data disk is in process of + /// detachment from the VirtualMachine/VirtualMachineScaleset + /// + [JsonProperty(PropertyName = "toBeDetached")] + public bool? ToBeDetached { get; set; } + + /// + /// Gets specifies the Read-Write IOPS for the managed disk when + /// StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; private set; } + + /// + /// Gets specifies the bandwidth in MB per second for the managed disk + /// when StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; private set; } + + /// + /// Gets or sets specifies the detach behavior to be used while + /// detaching a disk or which is already in the process of detachment + /// from the virtual machine. Supported values: **ForceDetach.** + /// detachOption: **ForceDetach** is applicable only for managed data + /// disks. If a previous detachment attempt of the data disk did not + /// complete due to an unexpected failure from the virtual machine and + /// the disk is still not released then use force-detach as a last + /// resort option to detach the disk forcibly from the VM. All writes + /// might not have been flushed when using this detach behavior. **This + /// feature is still in preview** mode and is not supported for + /// VirtualMachineScaleSet. To force-detach a data disk update + /// toBeDetached to 'true' along with setting detachOption: + /// 'ForceDetach'. Possible values include: 'ForceDetach' + /// + [JsonProperty(PropertyName = "detachOption")] + public string DetachOption { get; set; } + + /// + /// Gets or sets specifies whether data disk should be deleted or + /// detached upon VM deletion. Possible values are: **Delete.** If this + /// value is used, the data disk is deleted when VM is deleted. + /// **Detach.** If this value is used, the data disk is retained after + /// VM is deleted. The default value is set to **Detach**. Possible + /// values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImage.cs new file mode 100644 index 000000000000..2bf7163edbbf --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImage.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the data disk images information. + /// + public partial class DataDiskImage + { + /// + /// Initializes a new instance of the DataDiskImage class. + /// + public DataDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskImage class. + /// + /// 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. + public DataDiskImage(int? lun = default(int?)) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets 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. + /// + [JsonProperty(PropertyName = "lun")] + public int? Lun { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImageEncryption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImageEncryption.cs new file mode 100644 index 000000000000..a5a6152bb24d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DataDiskImageEncryption.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains encryption settings for a data disk image. + /// + public partial class DataDiskImageEncryption : DiskImageEncryption + { + /// + /// Initializes a new instance of the DataDiskImageEncryption class. + /// + public DataDiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDiskImageEncryption class. + /// + /// This property specifies the logical unit number + /// of the data disk. This value is used to identify data disks within + /// the Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// A relative URI containing the + /// resource ID of the disk encryption set. + public DataDiskImageEncryption(int lun, string diskEncryptionSetId = default(string)) + : base(diskEncryptionSetId) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the logical unit number of the + /// data disk. This value is used to identify data disks within the + /// Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHost.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHost.cs new file mode 100644 index 000000000000..6416b3b817ff --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHost.cs @@ -0,0 +1,185 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the Dedicated host. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHost : Resource + { + /// + /// Initializes a new instance of the DedicatedHost class. + /// + public DedicatedHost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHost class. + /// + /// Resource location + /// 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. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Fault domain of the dedicated + /// host within a dedicated host group. + /// Specifies whether the dedicated + /// host should be replaced automatically in case of a failure. The + /// value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the + /// dedicated host by the platform. Does not change throughout the + /// lifetime of the host. + /// A list of references to all virtual + /// machines in the Dedicated Host. + /// Specifies the software license type that + /// will be applied to the VMs deployed on the dedicated host. Possible + /// values are: **None,** **Windows_Server_Hybrid,** + /// **Windows_Server_Perpetual.** The default value is: **None.**. + /// Possible values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// The date when the host was first + /// provisioned. + /// The provisioning state, which only + /// appears in the response. + /// The dedicated host instance + /// view. + /// Specifies the time at which the Dedicated + /// Host resource was created. Minimum api-version: 2021-11-01. + public DedicatedHost(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? platformFaultDomain = default(int?), bool? autoReplaceOnFailure = default(bool?), string hostId = default(string), IList virtualMachines = default(IList), DedicatedHostLicenseTypes? licenseType = default(DedicatedHostLicenseTypes?), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), DedicatedHostInstanceView instanceView = default(DedicatedHostInstanceView), System.DateTime? timeCreated = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + PlatformFaultDomain = platformFaultDomain; + AutoReplaceOnFailure = autoReplaceOnFailure; + HostId = hostId; + VirtualMachines = virtualMachines; + LicenseType = licenseType; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fault domain of the dedicated host within a dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies whether the dedicated host should be + /// replaced automatically in case of a failure. The value is defaulted + /// to 'true' when not provided. + /// + [JsonProperty(PropertyName = "properties.autoReplaceOnFailure")] + public bool? AutoReplaceOnFailure { get; set; } + + /// + /// Gets a unique id generated and assigned to the dedicated host by + /// the platform. Does not change throughout the lifetime of the host. + /// + [JsonProperty(PropertyName = "properties.hostId")] + public string HostId { get; private set; } + + /// + /// Gets a list of references to all virtual machines in the Dedicated + /// Host. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets or sets specifies the software license type that will be + /// applied to the VMs deployed on the dedicated host. Possible values + /// are: **None,** **Windows_Server_Hybrid,** + /// **Windows_Server_Perpetual.** The default value is: **None.**. + /// Possible values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public DedicatedHostLicenseTypes? LicenseType { get; set; } + + /// + /// Gets the date when the host was first provisioned. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the dedicated host instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostInstanceView InstanceView { get; private set; } + + /// + /// Gets specifies the time at which the Dedicated Host resource was + /// created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (PlatformFaultDomain != null) + { + if (PlatformFaultDomain < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAllocatableVM.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAllocatableVM.cs new file mode 100644 index 000000000000..f0fc416b0752 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAllocatableVM.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents the dedicated host unutilized capacity in terms of a + /// specific VM size. + /// + public partial class DedicatedHostAllocatableVM + { + /// + /// Initializes a new instance of the DedicatedHostAllocatableVM class. + /// + public DedicatedHostAllocatableVM() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostAllocatableVM class. + /// + /// VM size in terms of which the unutilized + /// capacity is represented. + /// Maximum number of VMs of size vmSize that can + /// fit in the dedicated host's remaining capacity. + public DedicatedHostAllocatableVM(string vmSize = default(string), double? count = default(double?)) + { + VmSize = vmSize; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets VM size in terms of which the unutilized capacity is + /// represented. + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets maximum number of VMs of size vmSize that can fit in + /// the dedicated host's remaining capacity. + /// + [JsonProperty(PropertyName = "count")] + public double? Count { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAvailableCapacity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAvailableCapacity.cs new file mode 100644 index 000000000000..feb77504562d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostAvailableCapacity.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Dedicated host unutilized capacity. + /// + public partial class DedicatedHostAvailableCapacity + { + /// + /// Initializes a new instance of the DedicatedHostAvailableCapacity + /// class. + /// + public DedicatedHostAvailableCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostAvailableCapacity + /// class. + /// + /// The unutilized capacity of the + /// dedicated host represented in terms of each VM size that is allowed + /// to be deployed to the dedicated host. + public DedicatedHostAvailableCapacity(IList allocatableVMs = default(IList)) + { + AllocatableVMs = allocatableVMs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the unutilized capacity of the dedicated host + /// represented in terms of each VM size that is allowed to be deployed + /// to the dedicated host. + /// + [JsonProperty(PropertyName = "allocatableVMs")] + public IList AllocatableVMs { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroup.cs new file mode 100644 index 000000000000..046adc9f55a4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroup.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostGroup : Resource + { + /// + /// Initializes a new instance of the DedicatedHostGroup class. + /// + public DedicatedHostGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroup class. + /// + /// Resource location + /// Number of fault domains that + /// the host group can span. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A list of references to all dedicated hosts in + /// the dedicated host group. + /// The dedicated host group instance view, + /// which has the list of instance view of the dedicated hosts under + /// the dedicated host group. + /// 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. + /// Enables or disables a + /// capability on the dedicated host group. Minimum api-version: + /// 2022-03-01. + /// 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. + public DedicatedHostGroup(string location, int platformFaultDomainCount, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList hosts = default(IList), DedicatedHostGroupInstanceView instanceView = default(DedicatedHostGroupInstanceView), bool? supportAutomaticPlacement = default(bool?), DedicatedHostGroupPropertiesAdditionalCapabilities additionalCapabilities = default(DedicatedHostGroupPropertiesAdditionalCapabilities), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + AdditionalCapabilities = additionalCapabilities; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of fault domains that the host group can span. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int PlatformFaultDomainCount { get; set; } + + /// + /// Gets a list of references to all dedicated hosts in the dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.hosts")] + public IList Hosts { get; private set; } + + /// + /// Gets the dedicated host group instance view, which has the list of + /// instance view of the dedicated hosts under the dedicated host + /// group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostGroupInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.supportAutomaticPlacement")] + public bool? SupportAutomaticPlacement { get; set; } + + /// + /// Gets or sets enables or disables a capability on the dedicated host + /// group. Minimum api-version: 2022-03-01. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public DedicatedHostGroupPropertiesAdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PlatformFaultDomainCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupInstanceView.cs new file mode 100644 index 000000000000..3a12166c2020 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupInstanceView.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class DedicatedHostGroupInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostGroupInstanceView + /// class. + /// + public DedicatedHostGroupInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroupInstanceView + /// class. + /// + /// List of instance view of the dedicated hosts + /// under the dedicated host group. + public DedicatedHostGroupInstanceView(IList hosts = default(IList)) + { + Hosts = hosts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of instance view of the dedicated hosts under the + /// dedicated host group. + /// + [JsonProperty(PropertyName = "hosts")] + public IList Hosts { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs new file mode 100644 index 000000000000..a0b3626dacb2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Enables or disables a capability on the dedicated host group. Minimum + /// api-version: 2022-03-01. + /// + public partial class DedicatedHostGroupPropertiesAdditionalCapabilities + { + /// + /// Initializes a new instance of the + /// DedicatedHostGroupPropertiesAdditionalCapabilities class. + /// + public DedicatedHostGroupPropertiesAdditionalCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DedicatedHostGroupPropertiesAdditionalCapabilities class. + /// + /// The flag that enables or disables a + /// capability to have UltraSSD Enabled Virtual Machines on Dedicated + /// Hosts of the Dedicated Host Group. For the Virtual Machines to be + /// UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be + /// set true as well. The value is defaulted to 'false' when not + /// provided. Please refer to + /// https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd + /// for more details on Ultra SSD feature. **Note:** The + /// ultraSSDEnabled setting can only be enabled for Host Groups that + /// are created as zonal. Minimum api-version: 2022-03-01. + public DedicatedHostGroupPropertiesAdditionalCapabilities(bool? ultraSSDEnabled = default(bool?)) + { + UltraSSDEnabled = ultraSSDEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the flag that enables or disables a capability to have + /// UltraSSD Enabled Virtual Machines on Dedicated Hosts of the + /// Dedicated Host Group. For the Virtual Machines to be UltraSSD + /// Enabled, UltraSSDEnabled flag for the resource needs to be set true + /// as well. The value is defaulted to 'false' when not provided. + /// Please refer to + /// https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd + /// for more details on Ultra SSD feature. **Note:** The + /// ultraSSDEnabled setting can only be enabled for Host Groups that + /// are created as zonal. Minimum api-version: 2022-03-01. + /// + [JsonProperty(PropertyName = "ultraSSDEnabled")] + public bool? UltraSSDEnabled { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupUpdate.cs new file mode 100644 index 000000000000..537c52aa723f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostGroupUpdate.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the dedicated host group that the dedicated + /// host should be assigned to. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostGroupUpdate : UpdateResource + { + /// + /// Initializes a new instance of the DedicatedHostGroupUpdate class. + /// + public DedicatedHostGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostGroupUpdate class. + /// + /// Number of fault domains that + /// the host group can span. + /// Resource tags + /// A list of references to all dedicated hosts in + /// the dedicated host group. + /// The dedicated host group instance view, + /// which has the list of instance view of the dedicated hosts under + /// the dedicated host group. + /// 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. + /// Enables or disables a + /// capability on the dedicated host group. Minimum api-version: + /// 2022-03-01. + /// 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. + public DedicatedHostGroupUpdate(int platformFaultDomainCount, IDictionary tags = default(IDictionary), IList hosts = default(IList), DedicatedHostGroupInstanceView instanceView = default(DedicatedHostGroupInstanceView), bool? supportAutomaticPlacement = default(bool?), DedicatedHostGroupPropertiesAdditionalCapabilities additionalCapabilities = default(DedicatedHostGroupPropertiesAdditionalCapabilities), IList zones = default(IList)) + : base(tags) + { + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + AdditionalCapabilities = additionalCapabilities; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of fault domains that the host group can span. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int PlatformFaultDomainCount { get; set; } + + /// + /// Gets a list of references to all dedicated hosts in the dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.hosts")] + public IList Hosts { get; private set; } + + /// + /// Gets the dedicated host group instance view, which has the list of + /// instance view of the dedicated hosts under the dedicated host + /// group. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostGroupInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.supportAutomaticPlacement")] + public bool? SupportAutomaticPlacement { get; set; } + + /// + /// Gets or sets enables or disables a capability on the dedicated host + /// group. Minimum api-version: 2022-03-01. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public DedicatedHostGroupPropertiesAdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PlatformFaultDomainCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomainCount", 1); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceView.cs new file mode 100644 index 000000000000..6e25d0364b64 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceView.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a dedicated host. + /// + public partial class DedicatedHostInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostInstanceView class. + /// + public DedicatedHostInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostInstanceView class. + /// + /// Specifies the unique id of the dedicated + /// physical machine on which the dedicated host resides. + /// Unutilized capacity of the + /// dedicated host. + /// The resource status information. + public DedicatedHostInstanceView(string assetId = default(string), DedicatedHostAvailableCapacity availableCapacity = default(DedicatedHostAvailableCapacity), IList statuses = default(IList)) + { + AssetId = assetId; + AvailableCapacity = availableCapacity; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the unique id of the dedicated physical machine on + /// which the dedicated host resides. + /// + [JsonProperty(PropertyName = "assetId")] + public string AssetId { get; private set; } + + /// + /// Gets or sets unutilized capacity of the dedicated host. + /// + [JsonProperty(PropertyName = "availableCapacity")] + public DedicatedHostAvailableCapacity AvailableCapacity { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceViewWithName.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceViewWithName.cs new file mode 100644 index 000000000000..da90aa0c41e7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostInstanceViewWithName.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + public partial class DedicatedHostInstanceViewWithName : DedicatedHostInstanceView + { + /// + /// Initializes a new instance of the DedicatedHostInstanceViewWithName + /// class. + /// + public DedicatedHostInstanceViewWithName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostInstanceViewWithName + /// class. + /// + /// Specifies the unique id of the dedicated + /// physical machine on which the dedicated host resides. + /// Unutilized capacity of the + /// dedicated host. + /// The resource status information. + /// The name of the dedicated host. + public DedicatedHostInstanceViewWithName(string assetId = default(string), DedicatedHostAvailableCapacity availableCapacity = default(DedicatedHostAvailableCapacity), IList statuses = default(IList), string name = default(string)) + : base(assetId, availableCapacity, statuses) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the dedicated host. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostLicenseTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostLicenseTypes.cs new file mode 100644 index 000000000000..408c2b449d33 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostLicenseTypes.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DedicatedHostLicenseTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DedicatedHostLicenseTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Windows_Server_Hybrid")] + WindowsServerHybrid, + [EnumMember(Value = "Windows_Server_Perpetual")] + WindowsServerPerpetual + } + internal static class DedicatedHostLicenseTypesEnumExtension + { + internal static string ToSerializedValue(this DedicatedHostLicenseTypes? value) + { + return value == null ? null : ((DedicatedHostLicenseTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DedicatedHostLicenseTypes value) + { + switch( value ) + { + case DedicatedHostLicenseTypes.None: + return "None"; + case DedicatedHostLicenseTypes.WindowsServerHybrid: + return "Windows_Server_Hybrid"; + case DedicatedHostLicenseTypes.WindowsServerPerpetual: + return "Windows_Server_Perpetual"; + } + return null; + } + + internal static DedicatedHostLicenseTypes? ParseDedicatedHostLicenseTypes(this string value) + { + switch( value ) + { + case "None": + return DedicatedHostLicenseTypes.None; + case "Windows_Server_Hybrid": + return DedicatedHostLicenseTypes.WindowsServerHybrid; + case "Windows_Server_Perpetual": + return DedicatedHostLicenseTypes.WindowsServerPerpetual; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostUpdate.cs new file mode 100644 index 000000000000..e0ce0761c029 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DedicatedHostUpdate.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the dedicated host. Only tags, + /// autoReplaceOnFailure and licenseType may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class DedicatedHostUpdate : UpdateResource + { + /// + /// Initializes a new instance of the DedicatedHostUpdate class. + /// + public DedicatedHostUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedHostUpdate class. + /// + /// Resource tags + /// Fault domain of the dedicated + /// host within a dedicated host group. + /// Specifies whether the dedicated + /// host should be replaced automatically in case of a failure. The + /// value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the + /// dedicated host by the platform. Does not change throughout the + /// lifetime of the host. + /// A list of references to all virtual + /// machines in the Dedicated Host. + /// Specifies the software license type that + /// will be applied to the VMs deployed on the dedicated host. Possible + /// values are: **None,** **Windows_Server_Hybrid,** + /// **Windows_Server_Perpetual.** The default value is: **None.**. + /// Possible values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// The date when the host was first + /// provisioned. + /// The provisioning state, which only + /// appears in the response. + /// The dedicated host instance + /// view. + /// Specifies the time at which the Dedicated + /// Host resource was created. Minimum api-version: 2021-11-01. + /// [List all available dedicated host sizes for + /// resizing] + /// (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). + /// Resizing can be only used to scale up DedicatedHost. Only name is + /// required to be set. + public DedicatedHostUpdate(IDictionary tags = default(IDictionary), int? platformFaultDomain = default(int?), bool? autoReplaceOnFailure = default(bool?), string hostId = default(string), IList virtualMachines = default(IList), DedicatedHostLicenseTypes? licenseType = default(DedicatedHostLicenseTypes?), System.DateTime? provisioningTime = default(System.DateTime?), string provisioningState = default(string), DedicatedHostInstanceView instanceView = default(DedicatedHostInstanceView), System.DateTime? timeCreated = default(System.DateTime?), Sku sku = default(Sku)) + : base(tags) + { + PlatformFaultDomain = platformFaultDomain; + AutoReplaceOnFailure = autoReplaceOnFailure; + HostId = hostId; + VirtualMachines = virtualMachines; + LicenseType = licenseType; + ProvisioningTime = provisioningTime; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fault domain of the dedicated host within a dedicated + /// host group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies whether the dedicated host should be + /// replaced automatically in case of a failure. The value is defaulted + /// to 'true' when not provided. + /// + [JsonProperty(PropertyName = "properties.autoReplaceOnFailure")] + public bool? AutoReplaceOnFailure { get; set; } + + /// + /// Gets a unique id generated and assigned to the dedicated host by + /// the platform. Does not change throughout the lifetime of the host. + /// + [JsonProperty(PropertyName = "properties.hostId")] + public string HostId { get; private set; } + + /// + /// Gets a list of references to all virtual machines in the Dedicated + /// Host. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets or sets specifies the software license type that will be + /// applied to the VMs deployed on the dedicated host. Possible values + /// are: **None,** **Windows_Server_Hybrid,** + /// **Windows_Server_Perpetual.** The default value is: **None.**. + /// Possible values include: 'None', 'Windows_Server_Hybrid', + /// 'Windows_Server_Perpetual' + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public DedicatedHostLicenseTypes? LicenseType { get; set; } + + /// + /// Gets the date when the host was first provisioned. + /// + [JsonProperty(PropertyName = "properties.provisioningTime")] + public System.DateTime? ProvisioningTime { get; private set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the dedicated host instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public DedicatedHostInstanceView InstanceView { get; private set; } + + /// + /// Gets specifies the time at which the Dedicated Host resource was + /// created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets [List all available dedicated host sizes for resizing] + /// (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). + /// Resizing can be only used to scale up DedicatedHost. Only name is + /// required to be set. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PlatformFaultDomain != null) + { + if (PlatformFaultDomain < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PlatformFaultDomain", 0); + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DeleteOptions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DeleteOptions.cs new file mode 100644 index 000000000000..defbb5d32537 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DeleteOptions.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DeleteOptions. + /// + public static class DeleteOptions + { + public const string Delete = "Delete"; + public const string Detach = "Detach"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiagnosticsProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiagnosticsProfile.cs new file mode 100644 index 000000000000..682f24c59a9b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiagnosticsProfile.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the boot diagnostic settings state. Minimum api-version: + /// 2015-06-15. + /// + public partial class DiagnosticsProfile + { + /// + /// Initializes a new instance of the DiagnosticsProfile class. + /// + public DiagnosticsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticsProfile class. + /// + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. **NOTE**: If storageUri is being specified then + /// ensure that the storage account is in the same region and + /// subscription as the VM. You can easily view the output of your + /// console log. Azure also enables you to see a screenshot of the VM + /// from the hypervisor. + public DiagnosticsProfile(BootDiagnostics bootDiagnostics = default(BootDiagnostics)) + { + BootDiagnostics = bootDiagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// **NOTE**: If storageUri is being specified then ensure that the + /// storage account is in the same region and subscription as the VM. + /// You can easily view the output of your console log. Azure also + /// enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnostics BootDiagnostics { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskOptions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskOptions.cs new file mode 100644 index 000000000000..09c09a620cb3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskOptions.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiffDiskOptions. + /// + public static class DiffDiskOptions + { + public const string Local = "Local"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskPlacement.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskPlacement.cs new file mode 100644 index 000000000000..1ce5df37dc9e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskPlacement.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiffDiskPlacement. + /// + public static class DiffDiskPlacement + { + public const string CacheDisk = "CacheDisk"; + public const string ResourceDisk = "ResourceDisk"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskSettings.cs new file mode 100644 index 000000000000..1388b35ce8d8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiffDiskSettings.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the parameters of ephemeral disk settings that can be + /// specified for operating system disk. **Note:** The ephemeral disk + /// settings can only be specified for managed disk. + /// + public partial class DiffDiskSettings + { + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + public DiffDiskSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + /// Specifies the ephemeral disk settings for + /// operating system disk. Possible values include: 'Local' + /// Specifies the ephemeral disk placement for + /// operating system disk. Possible values are: **CacheDisk,** + /// **ResourceDisk.** The defaulting behavior is: **CacheDisk** if one + /// is configured for the VM size otherwise **ResourceDisk** is used. + /// Refer to the VM size documentation for Windows VM at + /// https://docs.microsoft.com/azure/virtual-machines/windows/sizes and + /// Linux VM at + /// https://docs.microsoft.com/azure/virtual-machines/linux/sizes to + /// check which VM sizes exposes a cache disk. Possible values include: + /// 'CacheDisk', 'ResourceDisk' + public DiffDiskSettings(string option = default(string), string placement = default(string)) + { + Option = option; + Placement = placement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the ephemeral disk settings for operating + /// system disk. Possible values include: 'Local' + /// + [JsonProperty(PropertyName = "option")] + public string Option { get; set; } + + /// + /// Gets or sets specifies the ephemeral disk placement for operating + /// system disk. Possible values are: **CacheDisk,** **ResourceDisk.** + /// The defaulting behavior is: **CacheDisk** if one is configured for + /// the VM size otherwise **ResourceDisk** is used. Refer to the VM + /// size documentation for Windows VM at + /// https://docs.microsoft.com/azure/virtual-machines/windows/sizes and + /// Linux VM at + /// https://docs.microsoft.com/azure/virtual-machines/linux/sizes to + /// check which VM sizes exposes a cache disk. Possible values include: + /// 'CacheDisk', 'ResourceDisk' + /// + [JsonProperty(PropertyName = "placement")] + public string Placement { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Disallowed.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Disallowed.cs new file mode 100644 index 000000000000..19df1e283280 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Disallowed.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the disallowed disk types. + /// + public partial class Disallowed + { + /// + /// Initializes a new instance of the Disallowed class. + /// + public Disallowed() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disallowed class. + /// + /// A list of disk types. + public Disallowed(IList diskTypes = default(IList)) + { + DiskTypes = diskTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of disk types. + /// + [JsonProperty(PropertyName = "diskTypes")] + public IList DiskTypes { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DisallowedConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DisallowedConfiguration.cs new file mode 100644 index 000000000000..cc640a3e69db --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DisallowedConfiguration.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the disallowed configuration for a virtual machine image. + /// + public partial class DisallowedConfiguration + { + /// + /// Initializes a new instance of the DisallowedConfiguration class. + /// + public DisallowedConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DisallowedConfiguration class. + /// + /// VM disk types which are disallowed. + /// Possible values include: 'None', 'Unmanaged' + public DisallowedConfiguration(string vmDiskType = default(string)) + { + VmDiskType = vmDiskType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets VM disk types which are disallowed. Possible values + /// include: 'None', 'Unmanaged' + /// + [JsonProperty(PropertyName = "vmDiskType")] + public string VmDiskType { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Disk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Disk.cs new file mode 100644 index 000000000000..cd8d34b12757 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Disk.cs @@ -0,0 +1,493 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Disk resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Disk : Resource + { + /// + /// Initializes a new instance of the Disk class. + /// + public Disk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disk class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A relative URI containing the ID of the VM + /// that has the disk attached. + /// List of relative URIs containing + /// the IDs of the VMs that have the disk attached. maxShares should be + /// set to a value greater than one for disks to allow attaching them + /// to multiple VMs. + /// The Logical zone list for Disk. + /// The extended location where the disk + /// will be created. Extended location cannot be changed. + /// The time when the disk was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the the + /// image from which the OS disk was created. E.g. - {name: + /// 2019-Datacenter, publisher: MicrosoftWindowsServer, product: + /// WindowsServer} + /// List of supported capabilities + /// for the image from which the OS disk was created. + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used for Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The state of the disk. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen', + /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload', + /// 'ActiveUpload' + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Details of the list of all VMs that have + /// the disk attached. maxShares should be set to a value greater than + /// one for disks to allow attaching them to multiple VMs. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Latest time when bursting was + /// last enabled on a disk. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// Set to true to enable bursting beyond + /// the provisioned performance target of the disk. Bursting is + /// disabled by default. Does not apply to Ultra disks. + /// Properties of the disk for + /// which update is pending. + /// Indicates the OS on a disk + /// supports hibernation. + /// Contains the security related + /// information for the resource. + /// Percentage complete for the + /// background copy when a resource is created via the CopyStart + /// operation. + /// Possible values include: + /// 'Enabled', 'Disabled' + /// Possible values include: + /// 'AzureActiveDirectory', 'None' + /// Setting this property to + /// true improves reliability and performance of data disks that are + /// frequently (more than 5 times a day) by detached from one virtual + /// machine and attached to another. This property should not be set + /// for disks that are not detached and attached frequently as it + /// causes the disks to not align with the fault domain of the virtual + /// machine. + /// The UTC time when the + /// ownership state of the disk was last changed i.e., the time the + /// disk was last attached or detached from a VM or the time when the + /// VM to which the disk was attached was deallocated or + /// started. + public Disk(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), IList managedByExtended = default(IList), DiskSku sku = default(DiskSku), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), long? diskIOPSReadOnly = default(long?), long? diskMBpsReadOnly = default(long?), string diskState = default(string), Encryption encryption = default(Encryption), int? maxShares = default(int?), IList shareInfo = default(IList), string networkAccessPolicy = default(string), string diskAccessId = default(string), System.DateTime? burstingEnabledTime = default(System.DateTime?), string tier = default(string), bool? burstingEnabled = default(bool?), PropertyUpdatesInProgress propertyUpdatesInProgress = default(PropertyUpdatesInProgress), bool? supportsHibernation = default(bool?), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), double? completionPercent = default(double?), string publicNetworkAccess = default(string), string dataAccessAuthMode = default(string), bool? optimizedForFrequentAttach = default(bool?), System.DateTime? lastOwnershipUpdateTime = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + ManagedByExtended = managedByExtended; + Sku = sku; + Zones = zones; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + DiskState = diskState; + Encryption = encryption; + MaxShares = maxShares; + ShareInfo = shareInfo; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + BurstingEnabledTime = burstingEnabledTime; + Tier = tier; + BurstingEnabled = burstingEnabled; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + SecurityProfile = securityProfile; + CompletionPercent = completionPercent; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + OptimizedForFrequentAttach = optimizedForFrequentAttach; + LastOwnershipUpdateTime = lastOwnershipUpdateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a relative URI containing the ID of the VM that has the disk + /// attached. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// Gets list of relative URIs containing the IDs of the VMs that have + /// the disk attached. maxShares should be set to a value greater than + /// one for disks to allow attaching them to multiple VMs. + /// + [JsonProperty(PropertyName = "managedByExtended")] + public IList ManagedByExtended { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + /// + /// Gets or sets the Logical zone list for Disk. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the extended location where the disk will be created. + /// Extended location cannot be changed. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets the time when the disk was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets purchase plan information for the the image from which + /// the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: + /// MicrosoftWindowsServer, product: WindowsServer} + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public PurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets list of supported capabilities for the image from + /// which the OS disk was created. + /// + [JsonProperty(PropertyName = "properties.supportedCapabilities")] + public SupportedCapabilities SupportedCapabilities { get; set; } + + /// + /// Gets or sets disk source information. CreationData information + /// cannot be changed after the disk has been created. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets the size of the disk in bytes. This field is read only. + /// + [JsonProperty(PropertyName = "properties.diskSizeBytes")] + public long? DiskSizeBytes { get; private set; } + + /// + /// Gets unique Guid identifying the resource. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets encryption settings collection used for Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets the disk provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the number of IOPS allowed for this disk; only + /// settable for UltraSSD disks. One operation can transfer between 4k + /// and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets the bandwidth allowed for this disk; only settable for + /// UltraSSD disks. MBps means millions of bytes per second - MB here + /// uses the ISO notation, of powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets the total number of IOPS that will be allowed across + /// all VMs mounting the shared disk as ReadOnly. One operation can + /// transfer between 4k and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadOnly")] + public long? DiskIOPSReadOnly { get; set; } + + /// + /// Gets or sets the total throughput (MBps) that will be allowed + /// across all VMs mounting the shared disk as ReadOnly. MBps means + /// millions of bytes per second - MB here uses the ISO notation, of + /// powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadOnly")] + public long? DiskMBpsReadOnly { get; set; } + + /// + /// Gets or sets the state of the disk. Possible values include: + /// 'Unattached', 'Attached', 'Reserved', 'Frozen', 'ActiveSAS', + /// 'ActiveSASFrozen', 'ReadyToUpload', 'ActiveUpload' + /// + [JsonProperty(PropertyName = "properties.diskState")] + public string DiskState { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets the maximum number of VMs that can attach to the disk + /// at the same time. Value greater than one indicates a disk that can + /// be mounted on multiple VMs at the same time. + /// + [JsonProperty(PropertyName = "properties.maxShares")] + public int? MaxShares { get; set; } + + /// + /// Gets details of the list of all VMs that have the disk attached. + /// maxShares should be set to a value greater than one for disks to + /// allow attaching them to multiple VMs. + /// + [JsonProperty(PropertyName = "properties.shareInfo")] + public IList ShareInfo { get; private set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets latest time when bursting was last enabled on a disk. + /// + [JsonProperty(PropertyName = "properties.burstingEnabledTime")] + public System.DateTime? BurstingEnabledTime { get; private set; } + + /// + /// Gets or sets performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Gets or sets set to true to enable bursting beyond the provisioned + /// performance target of the disk. Bursting is disabled by default. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.burstingEnabled")] + public bool? BurstingEnabled { get; set; } + + /// + /// Gets properties of the disk for which update is pending. + /// + [JsonProperty(PropertyName = "properties.propertyUpdatesInProgress")] + public PropertyUpdatesInProgress PropertyUpdatesInProgress { get; private set; } + + /// + /// Gets or sets indicates the OS on a disk supports hibernation. + /// + [JsonProperty(PropertyName = "properties.supportsHibernation")] + public bool? SupportsHibernation { get; set; } + + /// + /// Gets or sets contains the security related information for the + /// resource. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public DiskSecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets percentage complete for the background copy when a + /// resource is created via the CopyStart operation. + /// + [JsonProperty(PropertyName = "properties.completionPercent")] + public double? CompletionPercent { get; set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets possible values include: 'AzureActiveDirectory', + /// 'None' + /// + [JsonProperty(PropertyName = "properties.dataAccessAuthMode")] + public string DataAccessAuthMode { get; set; } + + /// + /// Gets or sets setting this property to true improves reliability and + /// performance of data disks that are frequently (more than 5 times a + /// day) by detached from one virtual machine and attached to another. + /// This property should not be set for disks that are not detached and + /// attached frequently as it causes the disks to not align with the + /// fault domain of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.optimizedForFrequentAttach")] + public bool? OptimizedForFrequentAttach { get; set; } + + /// + /// Gets the UTC time when the ownership state of the disk was last + /// changed i.e., the time the disk was last attached or detached from + /// a VM or the time when the VM to which the disk was attached was + /// deallocated or started. + /// + [JsonProperty(PropertyName = "properties.LastOwnershipUpdateTime")] + public System.DateTime? LastOwnershipUpdateTime { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CreationData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreationData"); + } + if (PurchasePlan != null) + { + PurchasePlan.Validate(); + } + if (CreationData != null) + { + CreationData.Validate(); + } + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccess.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccess.cs new file mode 100644 index 000000000000..e87d9e148ca8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccess.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk access resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskAccess : Resource + { + /// + /// Initializes a new instance of the DiskAccess class. + /// + public DiskAccess() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskAccess class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// A readonly collection of + /// private endpoint connections created on the disk. Currently only + /// one endpoint connection is supported. + /// The disk access resource + /// provisioning state. + /// The time when the disk access was + /// created. + /// The extended location where the disk + /// access will be created. Extended location cannot be + /// changed. + public DiskAccess(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList privateEndpointConnections = default(IList), string provisioningState = default(string), System.DateTime? timeCreated = default(System.DateTime?), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + PrivateEndpointConnections = privateEndpointConnections; + ProvisioningState = provisioningState; + TimeCreated = timeCreated; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a readonly collection of private endpoint connections created + /// on the disk. Currently only one endpoint connection is supported. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets the disk access resource provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the time when the disk access was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the extended location where the disk access will be + /// created. Extended location cannot be changed. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccessUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccessUpdate.cs new file mode 100644 index 000000000000..eb626405e5bb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskAccessUpdate.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Used for updating a disk access resource. + /// + public partial class DiskAccessUpdate + { + /// + /// Initializes a new instance of the DiskAccessUpdate class. + /// + public DiskAccessUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskAccessUpdate class. + /// + /// Resource tags + public DiskAccessUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskControllerTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskControllerTypes.cs new file mode 100644 index 000000000000..7f1ec2e2cfd5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskControllerTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskControllerTypes. + /// + public static class DiskControllerTypes + { + public const string SCSI = "SCSI"; + public const string NVMe = "NVMe"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOption.cs new file mode 100644 index 000000000000..dc062e280326 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOption.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskCreateOption. + /// + public static class DiskCreateOption + { + /// + /// Create an empty data disk of a size given by diskSizeGB. + /// + public const string Empty = "Empty"; + /// + /// Disk will be attached to a VM. + /// + public const string Attach = "Attach"; + /// + /// Create a new disk from a platform image specified by the given + /// imageReference or galleryImageReference. + /// + public const string FromImage = "FromImage"; + /// + /// Create a disk by importing from a blob specified by a sourceUri in + /// a storage account specified by storageAccountId. + /// + public const string Import = "Import"; + /// + /// Create a new disk or snapshot by copying from a disk or snapshot + /// specified by the given sourceResourceId. + /// + public const string Copy = "Copy"; + /// + /// Create a new disk by copying from a backup recovery point. + /// + public const string Restore = "Restore"; + /// + /// Create a new disk by obtaining a write token and using it to + /// directly upload the contents of the disk. + /// + public const string Upload = "Upload"; + /// + /// Create a new disk by using a deep copy process, where the resource + /// creation is considered complete only after all data has been copied + /// from the source. + /// + public const string CopyStart = "CopyStart"; + /// + /// Similar to Import create option. Create a new Trusted Launch VM or + /// Confidential VM supported disk by importing additional blob for VM + /// guest state specified by securityDataUri in storage account + /// specified by storageAccountId + /// + public const string ImportSecure = "ImportSecure"; + /// + /// Similar to Upload create option. Create a new Trusted Launch VM or + /// Confidential VM supported disk and upload using write token in both + /// disk and VM guest state + /// + public const string UploadPreparedSecure = "UploadPreparedSecure"; + /// + /// Create a new disk by exporting from elastic san volume snapshot + /// + public const string CopyFromSanSnapshot = "CopyFromSanSnapshot"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOptionTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOptionTypes.cs new file mode 100644 index 000000000000..6540322a7623 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskCreateOptionTypes.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskCreateOptionTypes. + /// + public static class DiskCreateOptionTypes + { + public const string FromImage = "FromImage"; + public const string Empty = "Empty"; + public const string Attach = "Attach"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDeleteOptionTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDeleteOptionTypes.cs new file mode 100644 index 000000000000..084e59e2d667 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDeleteOptionTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskDeleteOptionTypes. + /// + public static class DiskDeleteOptionTypes + { + public const string Delete = "Delete"; + public const string Detach = "Detach"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDetachOptionTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDetachOptionTypes.cs new file mode 100644 index 000000000000..9244426d7ec0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskDetachOptionTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskDetachOptionTypes. + /// + public static class DiskDetachOptionTypes + { + public const string ForceDetach = "ForceDetach"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSet.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSet.cs new file mode 100644 index 000000000000..d760c6523d8f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSet.cs @@ -0,0 +1,176 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSet : Resource + { + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + public DiskEncryptionSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys', + /// 'ConfidentialVmEncryptedWithCustomerKey' + /// The key vault key which is currently used + /// by this disk encryption set. + /// A readonly collection of key vault keys + /// previously used by this disk encryption set while a key rotation is + /// in progress. It will be empty if there is no ongoing key + /// rotation. + /// The disk encryption set + /// provisioning state. + /// Set this flag to + /// true to enable auto-updating of this disk encryption set to the + /// latest key version. + /// The time when the active key + /// of this disk encryption set was updated. + /// The error that was encountered + /// during auto-key rotation. If an error is present, then auto-key + /// rotation will not be attempted until the error on this disk + /// encryption set is fixed. + /// Multi-tenant application client id + /// to access key vault in a different tenant. Setting the value to + /// 'None' will clear the property. + public DiskEncryptionSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), EncryptionSetIdentity identity = default(EncryptionSetIdentity), string encryptionType = default(string), KeyForDiskEncryptionSet activeKey = default(KeyForDiskEncryptionSet), IList previousKeys = default(IList), string provisioningState = default(string), bool? rotationToLatestKeyVersionEnabled = default(bool?), System.DateTime? lastKeyRotationTimestamp = default(System.DateTime?), ApiError autoKeyRotationError = default(ApiError), string federatedClientId = default(string)) + : base(location, id, name, type, tags) + { + Identity = identity; + EncryptionType = encryptionType; + ActiveKey = activeKey; + PreviousKeys = previousKeys; + ProvisioningState = provisioningState; + RotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + LastKeyRotationTimestamp = lastKeyRotationTimestamp; + AutoKeyRotationError = autoKeyRotationError; + FederatedClientId = federatedClientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public EncryptionSetIdentity Identity { get; set; } + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys', + /// 'ConfidentialVmEncryptedWithCustomerKey' + /// + [JsonProperty(PropertyName = "properties.encryptionType")] + public string EncryptionType { get; set; } + + /// + /// Gets or sets the key vault key which is currently used by this disk + /// encryption set. + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyForDiskEncryptionSet ActiveKey { get; set; } + + /// + /// Gets a readonly collection of key vault keys previously used by + /// this disk encryption set while a key rotation is in progress. It + /// will be empty if there is no ongoing key rotation. + /// + [JsonProperty(PropertyName = "properties.previousKeys")] + public IList PreviousKeys { get; private set; } + + /// + /// Gets the disk encryption set provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets set this flag to true to enable auto-updating of this + /// disk encryption set to the latest key version. + /// + [JsonProperty(PropertyName = "properties.rotationToLatestKeyVersionEnabled")] + public bool? RotationToLatestKeyVersionEnabled { get; set; } + + /// + /// Gets the time when the active key of this disk encryption set was + /// updated. + /// + [JsonProperty(PropertyName = "properties.lastKeyRotationTimestamp")] + public System.DateTime? LastKeyRotationTimestamp { get; private set; } + + /// + /// Gets the error that was encountered during auto-key rotation. If an + /// error is present, then auto-key rotation will not be attempted + /// until the error on this disk encryption set is fixed. + /// + [JsonProperty(PropertyName = "properties.autoKeyRotationError")] + public ApiError AutoKeyRotationError { get; private set; } + + /// + /// Gets or sets multi-tenant application client id to access key vault + /// in a different tenant. Setting the value to 'None' will clear the + /// property. + /// + [JsonProperty(PropertyName = "properties.federatedClientId")] + public string FederatedClientId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + if (PreviousKeys != null) + { + foreach (var element in PreviousKeys) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetIdentityType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetIdentityType.cs new file mode 100644 index 000000000000..dae3e3996f18 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetIdentityType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskEncryptionSetIdentityType. + /// + public static class DiskEncryptionSetIdentityType + { + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned, UserAssigned"; + public const string None = "None"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetParameters.cs new file mode 100644 index 000000000000..d8b225b923be --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetParameters.cs @@ -0,0 +1,41 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using System.Linq; + + /// + /// 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. + /// + public partial class DiskEncryptionSetParameters : IResource + { + /// + /// Initializes a new instance of the DiskEncryptionSetParameters + /// class. + /// + public DiskEncryptionSetParameters() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetType.cs new file mode 100644 index 000000000000..8b65f1b98568 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetType.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskEncryptionSetType. + /// + public static class DiskEncryptionSetType + { + /// + /// Resource using diskEncryptionSet would be encrypted at rest with + /// Customer managed key that can be changed and revoked by a customer. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + /// + /// Resource using diskEncryptionSet would be encrypted at rest with + /// two layers of encryption. One of the keys is Customer managed and + /// the other key is Platform managed. + /// + public const string EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys"; + /// + /// Confidential VM supported disk and VM guest state would be + /// encrypted with customer managed key. + /// + public const string ConfidentialVmEncryptedWithCustomerKey = "ConfidentialVmEncryptedWithCustomerKey"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetUpdate.cs new file mode 100644 index 000000000000..410b7750b334 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSetUpdate.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSetUpdate + { + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + public DiskEncryptionSetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + /// Possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys', + /// 'ConfidentialVmEncryptedWithCustomerKey' + /// Set this flag to + /// true to enable auto-updating of this disk encryption set to the + /// latest key version. + /// Multi-tenant application client id + /// to access key vault in a different tenant. Setting the value to + /// 'None' will clear the property. + /// Resource tags + public DiskEncryptionSetUpdate(string encryptionType = default(string), KeyForDiskEncryptionSet activeKey = default(KeyForDiskEncryptionSet), bool? rotationToLatestKeyVersionEnabled = default(bool?), string federatedClientId = default(string), IDictionary tags = default(IDictionary), EncryptionSetIdentity identity = default(EncryptionSetIdentity)) + { + EncryptionType = encryptionType; + ActiveKey = activeKey; + RotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + FederatedClientId = federatedClientId; + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys', + /// 'ConfidentialVmEncryptedWithCustomerKey' + /// + [JsonProperty(PropertyName = "properties.encryptionType")] + public string EncryptionType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyForDiskEncryptionSet ActiveKey { get; set; } + + /// + /// Gets or sets set this flag to true to enable auto-updating of this + /// disk encryption set to the latest key version. + /// + [JsonProperty(PropertyName = "properties.rotationToLatestKeyVersionEnabled")] + public bool? RotationToLatestKeyVersionEnabled { get; set; } + + /// + /// Gets or sets multi-tenant application client id to access key vault + /// in a different tenant. Setting the value to 'None' will clear the + /// property. + /// + [JsonProperty(PropertyName = "properties.federatedClientId")] + public string FederatedClientId { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public EncryptionSetIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSettings.cs new file mode 100644 index 000000000000..b12e55e04b9e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskEncryptionSettings.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a Encryption Settings for a Disk + /// + public partial class DiskEncryptionSettings + { + /// + /// Initializes a new instance of the DiskEncryptionSettings class. + /// + public DiskEncryptionSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSettings class. + /// + /// Specifies the location of the disk + /// encryption key, which is a Key Vault Secret. + /// Specifies the location of the key + /// encryption key in Key Vault. + /// Specifies whether disk encryption should be + /// enabled on the virtual machine. + public DiskEncryptionSettings(KeyVaultSecretReference diskEncryptionKey = default(KeyVaultSecretReference), KeyVaultKeyReference keyEncryptionKey = default(KeyVaultKeyReference), bool? enabled = default(bool?)) + { + DiskEncryptionKey = diskEncryptionKey; + KeyEncryptionKey = keyEncryptionKey; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the location of the disk encryption key, + /// which is a Key Vault Secret. + /// + [JsonProperty(PropertyName = "diskEncryptionKey")] + public KeyVaultSecretReference DiskEncryptionKey { get; set; } + + /// + /// Gets or sets specifies the location of the key encryption key in + /// Key Vault. + /// + [JsonProperty(PropertyName = "keyEncryptionKey")] + public KeyVaultKeyReference KeyEncryptionKey { get; set; } + + /// + /// Gets or sets specifies whether disk encryption should be enabled on + /// the virtual machine. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DiskEncryptionKey != null) + { + DiskEncryptionKey.Validate(); + } + if (KeyEncryptionKey != null) + { + KeyEncryptionKey.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskImageEncryption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskImageEncryption.cs new file mode 100644 index 000000000000..ce3330d1cfc7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskImageEncryption.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the disk image encryption base class. + /// + public partial class DiskImageEncryption + { + /// + /// Initializes a new instance of the DiskImageEncryption class. + /// + public DiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskImageEncryption class. + /// + /// A relative URI containing the + /// resource ID of the disk encryption set. + public DiskImageEncryption(string diskEncryptionSetId = default(string)) + { + DiskEncryptionSetId = diskEncryptionSetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a relative URI containing the resource ID of the disk + /// encryption set. + /// + [JsonProperty(PropertyName = "diskEncryptionSetId")] + public string DiskEncryptionSetId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskInstanceView.cs new file mode 100644 index 000000000000..a1a45d7a1d23 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskInstanceView.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of the disk. + /// + public partial class DiskInstanceView + { + /// + /// Initializes a new instance of the DiskInstanceView class. + /// + public DiskInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskInstanceView class. + /// + /// The disk name. + /// Specifies the encryption settings + /// for the OS Disk. <br><br> Minimum api-version: + /// 2015-06-15 + /// The resource status information. + public DiskInstanceView(string name = default(string), IList encryptionSettings = default(IList), IList statuses = default(IList)) + { + Name = name; + EncryptionSettings = encryptionSettings; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the encryption settings for the OS Disk. + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public IList EncryptionSettings { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePoint.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePoint.cs new file mode 100644 index 000000000000..878fc1af0b18 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePoint.cs @@ -0,0 +1,231 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of disk restore point + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskRestorePoint : ProxyOnlyResource + { + /// + /// Initializes a new instance of the DiskRestorePoint class. + /// + public DiskRestorePoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskRestorePoint class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// The timestamp of restorePoint + /// creation + /// arm id of source disk or source disk + /// restore point. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the the + /// image from which the OS disk was created. + /// List of supported capabilities + /// for the image from which the OS disk was created. + /// id of the backing snapshot's MIS + /// family + /// unique incarnation id of the source + /// disk + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Indicates the OS on a disk + /// supports hibernation. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// Possible values include: + /// 'Enabled', 'Disabled' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Percentage complete for the + /// background copy of disk restore point when source resource is from + /// a different region. + /// Replication state of disk restore + /// point when source resource is from a different region. + /// Location of source disk or + /// source disk restore point when source resource is from a different + /// region. + /// Contains the security related + /// information for the resource. + public DiskRestorePoint(string id = default(string), string name = default(string), string type = default(string), System.DateTime? timeCreated = default(System.DateTime?), string sourceResourceId = default(string), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), string familyId = default(string), string sourceUniqueId = default(string), Encryption encryption = default(Encryption), bool? supportsHibernation = default(bool?), string networkAccessPolicy = default(string), string publicNetworkAccess = default(string), string diskAccessId = default(string), double? completionPercent = default(double?), string replicationState = default(string), string sourceResourceLocation = default(string), DiskSecurityProfile securityProfile = default(DiskSecurityProfile)) + : base(id, name, type) + { + TimeCreated = timeCreated; + SourceResourceId = sourceResourceId; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + FamilyId = familyId; + SourceUniqueId = sourceUniqueId; + Encryption = encryption; + SupportsHibernation = supportsHibernation; + NetworkAccessPolicy = networkAccessPolicy; + PublicNetworkAccess = publicNetworkAccess; + DiskAccessId = diskAccessId; + CompletionPercent = completionPercent; + ReplicationState = replicationState; + SourceResourceLocation = sourceResourceLocation; + SecurityProfile = securityProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the timestamp of restorePoint creation + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets arm id of source disk or source disk restore point. + /// + [JsonProperty(PropertyName = "properties.sourceResourceId")] + public string SourceResourceId { get; private set; } + + /// + /// Gets the Operating System type. Possible values include: 'Windows', + /// 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; private set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets purchase plan information for the the image from which + /// the OS disk was created. + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public PurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets list of supported capabilities for the image from + /// which the OS disk was created. + /// + [JsonProperty(PropertyName = "properties.supportedCapabilities")] + public SupportedCapabilities SupportedCapabilities { get; set; } + + /// + /// Gets id of the backing snapshot's MIS family + /// + [JsonProperty(PropertyName = "properties.familyId")] + public string FamilyId { get; private set; } + + /// + /// Gets unique incarnation id of the source disk + /// + [JsonProperty(PropertyName = "properties.sourceUniqueId")] + public string SourceUniqueId { get; private set; } + + /// + /// Gets encryption property can be used to encrypt data at rest with + /// customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; private set; } + + /// + /// Gets or sets indicates the OS on a disk supports hibernation. + /// + [JsonProperty(PropertyName = "properties.supportsHibernation")] + public bool? SupportsHibernation { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets percentage complete for the background copy of disk + /// restore point when source resource is from a different region. + /// + [JsonProperty(PropertyName = "properties.completionPercent")] + public double? CompletionPercent { get; set; } + + /// + /// Gets replication state of disk restore point when source resource + /// is from a different region. + /// + [JsonProperty(PropertyName = "properties.replicationState")] + public string ReplicationState { get; private set; } + + /// + /// Gets location of source disk or source disk restore point when + /// source resource is from a different region. + /// + [JsonProperty(PropertyName = "properties.sourceResourceLocation")] + public string SourceResourceLocation { get; private set; } + + /// + /// Gets or sets contains the security related information for the + /// resource. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public DiskSecurityProfile SecurityProfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PurchasePlan != null) + { + PurchasePlan.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointAttributes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointAttributes.cs new file mode 100644 index 000000000000..9c8e88698b97 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointAttributes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Disk Restore Point details. + /// + public partial class DiskRestorePointAttributes : SubResourceReadOnly + { + /// + /// Initializes a new instance of the DiskRestorePointAttributes class. + /// + public DiskRestorePointAttributes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskRestorePointAttributes class. + /// + /// Resource Id + /// Resource Id of the source disk + /// restore point. + public DiskRestorePointAttributes(string id = default(string), RestorePointEncryption encryption = default(RestorePointEncryption), ApiEntityReference sourceDiskRestorePoint = default(ApiEntityReference)) + : base(id) + { + Encryption = encryption; + SourceDiskRestorePoint = sourceDiskRestorePoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "encryption")] + public RestorePointEncryption Encryption { get; set; } + + /// + /// Gets or sets resource Id of the source disk restore point. + /// + [JsonProperty(PropertyName = "sourceDiskRestorePoint")] + public ApiEntityReference SourceDiskRestorePoint { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointInstanceView.cs new file mode 100644 index 000000000000..75bb938480f2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointInstanceView.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The instance view of a disk restore point. + /// + public partial class DiskRestorePointInstanceView + { + /// + /// Initializes a new instance of the DiskRestorePointInstanceView + /// class. + /// + public DiskRestorePointInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskRestorePointInstanceView + /// class. + /// + /// Disk restore point Id. + /// The disk restore point replication + /// status information. + public DiskRestorePointInstanceView(string id = default(string), DiskRestorePointReplicationStatus replicationStatus = default(DiskRestorePointReplicationStatus)) + { + Id = id; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets disk restore point Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the disk restore point replication status information. + /// + [JsonProperty(PropertyName = "replicationStatus")] + public DiskRestorePointReplicationStatus ReplicationStatus { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointReplicationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointReplicationStatus.cs new file mode 100644 index 000000000000..5ab6ff044d13 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskRestorePointReplicationStatus.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The instance view of a disk restore point. + /// + public partial class DiskRestorePointReplicationStatus + { + /// + /// Initializes a new instance of the DiskRestorePointReplicationStatus + /// class. + /// + public DiskRestorePointReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskRestorePointReplicationStatus + /// class. + /// + /// The resource status information. + /// Replication completion + /// percentage. + public DiskRestorePointReplicationStatus(InstanceViewStatus status = default(InstanceViewStatus), int? completionPercent = default(int?)) + { + Status = status; + CompletionPercent = completionPercent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; set; } + + /// + /// Gets or sets replication completion percentage. + /// + [JsonProperty(PropertyName = "completionPercent")] + public int? CompletionPercent { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityProfile.cs new file mode 100644 index 000000000000..797607a2cc4a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityProfile.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the security related information for the resource. + /// + public partial class DiskSecurityProfile + { + /// + /// Initializes a new instance of the DiskSecurityProfile class. + /// + public DiskSecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskSecurityProfile class. + /// + /// Possible values include: + /// 'TrustedLaunch', + /// 'ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey', + /// 'ConfidentialVM_DiskEncryptedWithPlatformKey', + /// 'ConfidentialVM_DiskEncryptedWithCustomerKey' + /// ResourceId of the disk + /// encryption set associated to Confidential VM supported disk + /// encrypted with customer managed key + public DiskSecurityProfile(string securityType = default(string), string secureVMDiskEncryptionSetId = default(string)) + { + SecurityType = securityType; + SecureVMDiskEncryptionSetId = secureVMDiskEncryptionSetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'TrustedLaunch', + /// 'ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey', + /// 'ConfidentialVM_DiskEncryptedWithPlatformKey', + /// 'ConfidentialVM_DiskEncryptedWithCustomerKey' + /// + [JsonProperty(PropertyName = "securityType")] + public string SecurityType { get; set; } + + /// + /// Gets or sets resourceId of the disk encryption set associated to + /// Confidential VM supported disk encrypted with customer managed key + /// + [JsonProperty(PropertyName = "secureVMDiskEncryptionSetId")] + public string SecureVMDiskEncryptionSetId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityTypes.cs new file mode 100644 index 000000000000..38c0b703ba18 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSecurityTypes.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskSecurityTypes. + /// + public static class DiskSecurityTypes + { + /// + /// Trusted Launch provides security features such as secure boot and + /// virtual Trusted Platform Module (vTPM) + /// + public const string TrustedLaunch = "TrustedLaunch"; + /// + /// Indicates Confidential VM disk with only VM guest state encrypted + /// + public const string ConfidentialVMVMGuestStateOnlyEncryptedWithPlatformKey = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"; + /// + /// Indicates Confidential VM disk with both OS disk and VM guest state + /// encrypted with a platform managed key + /// + public const string ConfidentialVMDiskEncryptedWithPlatformKey = "ConfidentialVM_DiskEncryptedWithPlatformKey"; + /// + /// Indicates Confidential VM disk with both OS disk and VM guest state + /// encrypted with a customer managed key + /// + public const string ConfidentialVMDiskEncryptedWithCustomerKey = "ConfidentialVM_DiskEncryptedWithCustomerKey"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSku.cs new file mode 100644 index 000000000000..19e3d33ddedf --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskSku.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + /// UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + /// + public partial class DiskSku + { + /// + /// Initializes a new instance of the DiskSku class. + /// + public DiskSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskSku class. + /// + /// The sku name. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// The sku tier. + public DiskSku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku name. Possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', 'Premium_ZRS', + /// 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the sku tier. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskState.cs new file mode 100644 index 000000000000..c1c3c4072ec0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskState.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskState. + /// + public static class DiskState + { + /// + /// The disk is not being used and can be attached to a VM. + /// + public const string Unattached = "Unattached"; + /// + /// The disk is currently attached to a running VM. + /// + public const string Attached = "Attached"; + /// + /// The disk is attached to a stopped-deallocated VM. + /// + public const string Reserved = "Reserved"; + /// + /// The disk is attached to a VM which is in hibernated state. + /// + public const string Frozen = "Frozen"; + /// + /// The disk currently has an Active SAS Uri associated with it. + /// + public const string ActiveSAS = "ActiveSAS"; + /// + /// The disk is attached to a VM in hibernated state and has an active + /// SAS URI associated with it. + /// + public const string ActiveSASFrozen = "ActiveSASFrozen"; + /// + /// A disk is ready to be created by upload by requesting a write + /// token. + /// + public const string ReadyToUpload = "ReadyToUpload"; + /// + /// A disk is created for upload and a write token has been issued for + /// uploading to it. + /// + public const string ActiveUpload = "ActiveUpload"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskStorageAccountTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskStorageAccountTypes.cs new file mode 100644 index 000000000000..9832862b6cc0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskStorageAccountTypes.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskStorageAccountTypes. + /// + public static class DiskStorageAccountTypes + { + /// + /// Standard HDD locally redundant storage. Best for backup, + /// non-critical, and infrequent access. + /// + public const string StandardLRS = "Standard_LRS"; + /// + /// Premium SSD locally redundant storage. Best for production and + /// performance sensitive workloads. + /// + public const string PremiumLRS = "Premium_LRS"; + /// + /// Standard SSD locally redundant storage. Best for web servers, + /// lightly used enterprise applications and dev/test. + /// + public const string StandardSSDLRS = "StandardSSD_LRS"; + /// + /// Ultra SSD locally redundant storage. Best for IO-intensive + /// workloads such as SAP HANA, top tier databases (for example, SQL, + /// Oracle), and other transaction-heavy workloads. + /// + public const string UltraSSDLRS = "UltraSSD_LRS"; + /// + /// Premium SSD zone redundant storage. Best for the production + /// workloads that need storage resiliency against zone failures. + /// + public const string PremiumZRS = "Premium_ZRS"; + /// + /// Standard SSD zone redundant storage. Best for web servers, lightly + /// used enterprise applications and dev/test that need storage + /// resiliency against zone failures. + /// + public const string StandardSSDZRS = "StandardSSD_ZRS"; + /// + /// Premium SSD v2 locally redundant storage. Best for production and + /// performance-sensitive workloads that consistently require low + /// latency and high IOPS and throughput. + /// + public const string PremiumV2LRS = "PremiumV2_LRS"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DiskUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskUpdate.cs new file mode 100644 index 000000000000..67b0788fea49 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DiskUpdate.cs @@ -0,0 +1,313 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Disk update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskUpdate + { + /// + /// Initializes a new instance of the DiskUpdate class. + /// + public DiskUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The number of IOPS allowed for this + /// disk; only settable for UltraSSD disks. One operation can transfer + /// between 4k and 256k bytes. + /// The bandwidth allowed for this + /// disk; only settable for UltraSSD disks. MBps means millions of + /// bytes per second - MB here uses the ISO notation, of powers of + /// 10. + /// The total number of IOPS that will + /// be allowed across all VMs mounting the shared disk as ReadOnly. One + /// operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that + /// will be allowed across all VMs mounting the shared disk as + /// ReadOnly. MBps means millions of bytes per second - MB here uses + /// the ISO notation, of powers of 10. + /// The maximum number of VMs that can attach + /// to the disk at the same time. Value greater than one indicates a + /// disk that can be mounted on multiple VMs at the same time. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// Set to true to enable bursting beyond + /// the provisioned performance target of the disk. Bursting is + /// disabled by default. Does not apply to Ultra disks. + /// Purchase plan information to be added on + /// the OS disk + /// List of supported capabilities + /// to be added on the OS disk. + /// Properties of the disk for + /// which update is pending. + /// Indicates the OS on a disk + /// supports hibernation. + /// Possible values include: + /// 'Enabled', 'Disabled' + /// Possible values include: + /// 'AzureActiveDirectory', 'None' + /// Setting this property to + /// true improves reliability and performance of data disks that are + /// frequently (more than 5 times a day) by detached from one virtual + /// machine and attached to another. This property should not be set + /// for disks that are not detached and attached frequently as it + /// causes the disks to not align with the fault domain of the virtual + /// machine. + /// Resource tags + public DiskUpdate(OperatingSystemTypes? osType = default(OperatingSystemTypes?), int? diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), long? diskIOPSReadOnly = default(long?), long? diskMBpsReadOnly = default(long?), int? maxShares = default(int?), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), string tier = default(string), bool? burstingEnabled = default(bool?), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), PropertyUpdatesInProgress propertyUpdatesInProgress = default(PropertyUpdatesInProgress), bool? supportsHibernation = default(bool?), string publicNetworkAccess = default(string), string dataAccessAuthMode = default(string), bool? optimizedForFrequentAttach = default(bool?), IDictionary tags = default(IDictionary), DiskSku sku = default(DiskSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIOPSReadOnly = diskIOPSReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + OptimizedForFrequentAttach = optimizedForFrequentAttach; + Tags = tags; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets or sets the number of IOPS allowed for this disk; only + /// settable for UltraSSD disks. One operation can transfer between 4k + /// and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets the bandwidth allowed for this disk; only settable for + /// UltraSSD disks. MBps means millions of bytes per second - MB here + /// uses the ISO notation, of powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets the total number of IOPS that will be allowed across + /// all VMs mounting the shared disk as ReadOnly. One operation can + /// transfer between 4k and 256k bytes. + /// + [JsonProperty(PropertyName = "properties.diskIOPSReadOnly")] + public long? DiskIOPSReadOnly { get; set; } + + /// + /// Gets or sets the total throughput (MBps) that will be allowed + /// across all VMs mounting the shared disk as ReadOnly. MBps means + /// millions of bytes per second - MB here uses the ISO notation, of + /// powers of 10. + /// + [JsonProperty(PropertyName = "properties.diskMBpsReadOnly")] + public long? DiskMBpsReadOnly { get; set; } + + /// + /// Gets or sets the maximum number of VMs that can attach to the disk + /// at the same time. Value greater than one indicates a disk that can + /// be mounted on multiple VMs at the same time. + /// + [JsonProperty(PropertyName = "properties.maxShares")] + public int? MaxShares { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets performance tier of the disk (e.g, P4, S10) as + /// described here: + /// https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Gets or sets set to true to enable bursting beyond the provisioned + /// performance target of the disk. Bursting is disabled by default. + /// Does not apply to Ultra disks. + /// + [JsonProperty(PropertyName = "properties.burstingEnabled")] + public bool? BurstingEnabled { get; set; } + + /// + /// Gets or sets purchase plan information to be added on the OS disk + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public PurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets list of supported capabilities to be added on the OS + /// disk. + /// + [JsonProperty(PropertyName = "properties.supportedCapabilities")] + public SupportedCapabilities SupportedCapabilities { get; set; } + + /// + /// Gets properties of the disk for which update is pending. + /// + [JsonProperty(PropertyName = "properties.propertyUpdatesInProgress")] + public PropertyUpdatesInProgress PropertyUpdatesInProgress { get; private set; } + + /// + /// Gets or sets indicates the OS on a disk supports hibernation. + /// + [JsonProperty(PropertyName = "properties.supportsHibernation")] + public bool? SupportsHibernation { get; set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets possible values include: 'AzureActiveDirectory', + /// 'None' + /// + [JsonProperty(PropertyName = "properties.dataAccessAuthMode")] + public string DataAccessAuthMode { get; set; } + + /// + /// Gets or sets setting this property to true improves reliability and + /// performance of data disks that are frequently (more than 5 times a + /// day) by detached from one virtual machine and attached to another. + /// This property should not be set for disks that are not detached and + /// attached frequently as it causes the disks to not align with the + /// fault domain of the virtual machine. + /// + [JsonProperty(PropertyName = "properties.optimizedForFrequentAttach")] + public bool? OptimizedForFrequentAttach { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + if (PurchasePlan != null) + { + PurchasePlan.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/DomainNameLabelScopeTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/DomainNameLabelScopeTypes.cs new file mode 100644 index 000000000000..44f9b71b0a4a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/DomainNameLabelScopeTypes.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DomainNameLabelScopeTypes. + /// + public static class DomainNameLabelScopeTypes + { + public const string TenantReuse = "TenantReuse"; + public const string SubscriptionReuse = "SubscriptionReuse"; + public const string ResourceGroupReuse = "ResourceGroupReuse"; + public const string NoReuse = "NoReuse"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EdgeZoneStorageAccountType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EdgeZoneStorageAccountType.cs new file mode 100644 index 000000000000..858983d3aa61 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EdgeZoneStorageAccountType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for EdgeZoneStorageAccountType. + /// + public static class EdgeZoneStorageAccountType + { + public const string StandardLRS = "Standard_LRS"; + public const string StandardZRS = "Standard_ZRS"; + public const string StandardSSDLRS = "StandardSSD_LRS"; + public const string PremiumLRS = "Premium_LRS"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Encryption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Encryption.cs new file mode 100644 index 000000000000..345dec01e4c3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Encryption.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Encryption at rest settings for disk or snapshot + /// + public partial class Encryption + { + /// + /// Initializes a new instance of the Encryption class. + /// + public Encryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Encryption class. + /// + /// ResourceId of the disk encryption + /// set to use for enabling encryption at rest. + /// Possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + public Encryption(string diskEncryptionSetId = default(string), string type = default(string)) + { + DiskEncryptionSetId = diskEncryptionSetId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resourceId of the disk encryption set to use for + /// enabling encryption at rest. + /// + [JsonProperty(PropertyName = "diskEncryptionSetId")] + public string DiskEncryptionSetId { get; set; } + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionImages.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionImages.cs new file mode 100644 index 000000000000..de2b2529bdfe --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionImages.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Optional. Allows users to provide customer managed keys for encrypting + /// the OS and data disks in the gallery artifact. + /// + public partial class EncryptionImages + { + /// + /// Initializes a new instance of the EncryptionImages class. + /// + public EncryptionImages() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionImages class. + /// + /// A list of encryption specifications + /// for data disk images. + public EncryptionImages(OSDiskImageEncryption osDiskImage = default(OSDiskImageEncryption), IList dataDiskImages = default(IList)) + { + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "osDiskImage")] + public OSDiskImageEncryption OsDiskImage { get; set; } + + /// + /// Gets or sets a list of encryption specifications for data disk + /// images. + /// + [JsonProperty(PropertyName = "dataDiskImages")] + public IList DataDiskImages { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSetIdentity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSetIdentity.cs new file mode 100644 index 000000000000..a0dbd9f9dcae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSetIdentity.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + public partial class EncryptionSetIdentity + { + /// + /// Initializes a new instance of the EncryptionSetIdentity class. + /// + public EncryptionSetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSetIdentity class. + /// + /// The type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported for new + /// creations. Disk Encryption Sets can be updated with Identity type + /// None during migration of subscription to a new Azure Active + /// Directory tenant; it will cause the encrypted resources to lose + /// access to the keys. Possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + /// The object id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-identity-principal-id header in the PUT request if the + /// resource has a systemAssigned(implicit) identity + /// The tenant id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-client-tenant-id header in the PUT request if the resource has + /// a systemAssigned(implicit) identity + /// The list of user identities + /// associated with the disk encryption set. The user identity + /// dictionary key references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public EncryptionSetIdentity(string type = default(string), string principalId = default(string), string tenantId = default(string), IDictionary userAssignedIdentities = default(IDictionary)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported for new + /// creations. Disk Encryption Sets can be updated with Identity type + /// None during migration of subscription to a new Azure Active + /// Directory tenant; it will cause the encrypted resources to lose + /// access to the keys. Possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets the object id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-identity-principal-id header + /// in the PUT request if the resource has a systemAssigned(implicit) + /// identity + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-client-tenant-id header in the + /// PUT request if the resource has a systemAssigned(implicit) identity + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the list of user identities associated with the disk + /// encryption set. The user identity dictionary key references will be + /// ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsCollection.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsCollection.cs new file mode 100644 index 000000000000..3e942e2731b7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsCollection.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Encryption settings for disk or snapshot + /// + public partial class EncryptionSettingsCollection + { + /// + /// Initializes a new instance of the EncryptionSettingsCollection + /// class. + /// + public EncryptionSettingsCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSettingsCollection + /// class. + /// + /// Set this flag to true and provide + /// DiskEncryptionKey and optional KeyEncryptionKey to enable + /// encryption. Set this flag to false and remove DiskEncryptionKey and + /// KeyEncryptionKey to disable encryption. If EncryptionSettings is + /// null in the request object, the existing settings remain + /// unchanged. + /// A collection of encryption + /// settings, one for each disk volume. + /// Describes what type of + /// encryption is used for the disks. Once this field is set, it cannot + /// be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD + /// app.'1.1' corresponds to Azure Disk Encryption. + public EncryptionSettingsCollection(bool enabled, IList encryptionSettings = default(IList), string encryptionSettingsVersion = default(string)) + { + Enabled = enabled; + EncryptionSettings = encryptionSettings; + EncryptionSettingsVersion = encryptionSettingsVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets set this flag to true and provide DiskEncryptionKey + /// and optional KeyEncryptionKey to enable encryption. Set this flag + /// to false and remove DiskEncryptionKey and KeyEncryptionKey to + /// disable encryption. If EncryptionSettings is null in the request + /// object, the existing settings remain unchanged. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets a collection of encryption settings, one for each disk + /// volume. + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public IList EncryptionSettings { get; set; } + + /// + /// Gets or sets describes what type of encryption is used for the + /// disks. Once this field is set, it cannot be overwritten. '1.0' + /// corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + /// to Azure Disk Encryption. + /// + [JsonProperty(PropertyName = "encryptionSettingsVersion")] + public string EncryptionSettingsVersion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettings != null) + { + foreach (var element in EncryptionSettings) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsElement.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsElement.cs new file mode 100644 index 000000000000..074af2eb92f0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionSettingsElement.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Encryption settings for one disk volume. + /// + public partial class EncryptionSettingsElement + { + /// + /// Initializes a new instance of the EncryptionSettingsElement class. + /// + public EncryptionSettingsElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSettingsElement class. + /// + /// Key Vault Secret Url and vault id + /// of the disk encryption key + /// Key Vault Key Url and vault id of + /// the key encryption key. KeyEncryptionKey is optional and when + /// provided is used to unwrap the disk encryption key. + public EncryptionSettingsElement(KeyVaultAndSecretReference diskEncryptionKey = default(KeyVaultAndSecretReference), KeyVaultAndKeyReference keyEncryptionKey = default(KeyVaultAndKeyReference)) + { + DiskEncryptionKey = diskEncryptionKey; + KeyEncryptionKey = keyEncryptionKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets key Vault Secret Url and vault id of the disk + /// encryption key + /// + [JsonProperty(PropertyName = "diskEncryptionKey")] + public KeyVaultAndSecretReference DiskEncryptionKey { get; set; } + + /// + /// Gets or sets key Vault Key Url and vault id of the key encryption + /// key. KeyEncryptionKey is optional and when provided is used to + /// unwrap the disk encryption key. + /// + [JsonProperty(PropertyName = "keyEncryptionKey")] + public KeyVaultAndKeyReference KeyEncryptionKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DiskEncryptionKey != null) + { + DiskEncryptionKey.Validate(); + } + if (KeyEncryptionKey != null) + { + KeyEncryptionKey.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionType.cs new file mode 100644 index 000000000000..fd806754ff4e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/EncryptionType.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for EncryptionType. + /// + public static class EncryptionType + { + /// + /// Disk is encrypted at rest with Platform managed key. It is the + /// default encryption type. This is not a valid encryption type for + /// disk encryption sets. + /// + public const string EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey"; + /// + /// Disk is encrypted at rest with Customer managed key that can be + /// changed and revoked by a customer. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + /// + /// Disk is encrypted at rest with 2 layers of encryption. One of the + /// keys is Customer managed and the other key is Platform managed. + /// + public const string EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExecutionState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExecutionState.cs new file mode 100644 index 000000000000..ccc2a5c844a1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExecutionState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExecutionState. + /// + public static class ExecutionState + { + public const string Unknown = "Unknown"; + public const string Pending = "Pending"; + public const string Running = "Running"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string TimedOut = "TimedOut"; + public const string Canceled = "Canceled"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypeForListVMs.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypeForListVMs.cs new file mode 100644 index 000000000000..775973900455 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypeForListVMs.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExpandTypeForListVMs. + /// + public static class ExpandTypeForListVMs + { + public const string InstanceView = "instanceView"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetCapacityReservationGroups.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetCapacityReservationGroups.cs new file mode 100644 index 000000000000..4bc38cee587a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetCapacityReservationGroups.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExpandTypesForGetCapacityReservationGroups. + /// + public static class ExpandTypesForGetCapacityReservationGroups + { + public const string VirtualMachineScaleSetVMsRef = "virtualMachineScaleSetVMs/$ref"; + public const string VirtualMachinesRef = "virtualMachines/$ref"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetVMScaleSets.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetVMScaleSets.cs new file mode 100644 index 000000000000..c408275aa4b7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForGetVMScaleSets.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExpandTypesForGetVMScaleSets. + /// + public static class ExpandTypesForGetVMScaleSets + { + public const string UserData = "userData"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForListVMs.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForListVMs.cs new file mode 100644 index 000000000000..965d910a75f5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExpandTypesForListVMs.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExpandTypesForListVMs. + /// + public static class ExpandTypesForListVMs + { + public const string InstanceView = "instanceView"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocation.cs new file mode 100644 index 000000000000..d1b9f2912802 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The complex type of the extended location. + /// + public partial class ExtendedLocation + { + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + public ExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + /// The name of the extended location. + /// The type of the extended location. Possible + /// values include: 'EdgeZone' + public ExtendedLocation(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extended location. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of the extended location. Possible values + /// include: 'EdgeZone' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationType.cs new file mode 100644 index 000000000000..ea68e664029e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExtendedLocationType. + /// + public static class ExtendedLocationType + { + public const string EdgeZone = "EdgeZone"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 000000000000..77e0b2c66958 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ExtendedLocationTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ExtendedLocationTypes. + /// + public static class ExtendedLocationTypes + { + public const string EdgeZone = "EdgeZone"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Extension.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Extension.cs new file mode 100644 index 000000000000..66db804aec3f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Extension.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service Extension. + /// + public partial class Extension + { + /// + /// Initializes a new instance of the Extension class. + /// + public Extension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Extension class. + /// + /// The name of the extension. + public Extension(string name = default(string), CloudServiceExtensionProperties properties = default(CloudServiceExtensionProperties)) + { + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public CloudServiceExtensionProperties Properties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/FileFormat.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/FileFormat.cs new file mode 100644 index 000000000000..c96720425ff3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/FileFormat.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for FileFormat. + /// + public static class FileFormat + { + /// + /// A VHD file is a disk image file in the Virtual Hard Disk file + /// format. + /// + public const string VHD = "VHD"; + /// + /// A VHDX file is a disk image file in the Virtual Hard Disk v2 file + /// format. + /// + public const string VHDX = "VHDX"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Gallery.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Gallery.cs new file mode 100644 index 000000000000..daa223602611 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Gallery.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the Shared Image Gallery that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class Gallery : Resource + { + /// + /// Initializes a new instance of the Gallery class. + /// + public Gallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Gallery class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this Shared Image + /// Gallery resource. This property is updatable. + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public Gallery(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string), SharingProfile sharingProfile = default(SharingProfile), SoftDeletePolicy softDeletePolicy = default(SoftDeletePolicy), SharingStatus sharingStatus = default(SharingStatus)) + : base(location, id, name, type, tags) + { + Description = description; + Identifier = identifier; + ProvisioningState = provisioningState; + SharingProfile = sharingProfile; + SoftDeletePolicy = softDeletePolicy; + SharingStatus = sharingStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this Shared Image Gallery resource. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryIdentifier Identifier { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.softDeletePolicy")] + public SoftDeletePolicy SoftDeletePolicy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingStatus")] + public SharingStatus SharingStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplication.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplication.cs new file mode 100644 index 000000000000..ab76da02efee --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplication.cs @@ -0,0 +1,154 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery Application Definition that you + /// want to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplication : Resource + { + /// + /// Initializes a new instance of the GalleryApplication class. + /// + public GalleryApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplication class. + /// + /// Resource location + /// This property allows you to specify + /// the supported type of the OS that application is built for. + /// <br><br> Possible values are: <br><br> + /// **Windows** <br><br> **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery + /// Application Definition resource. This property is + /// updatable. + /// The Eula agreement for the gallery Application + /// Definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The end of life date of the gallery + /// Application Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + /// A list of custom actions that can be + /// performed with all of the Gallery Application Versions within this + /// Gallery Application. + public GalleryApplication(string location, OperatingSystemTypes supportedOSType, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), IList customActions = default(IList)) + : base(location, id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + EndOfLifeDate = endOfLifeDate; + SupportedOSType = supportedOSType; + CustomActions = customActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery Application Definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery Application + /// Definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets the end of life date of the gallery Application + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets this property allows you to specify the supported type + /// of the OS that application is built for. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.supportedOSType")] + public OperatingSystemTypes SupportedOSType { get; set; } + + /// + /// Gets or sets a list of custom actions that can be performed with + /// all of the Gallery Application Versions within this Gallery + /// Application. + /// + [JsonProperty(PropertyName = "properties.customActions")] + public IList CustomActions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CustomActions != null) + { + foreach (var element in CustomActions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomAction.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomAction.cs new file mode 100644 index 000000000000..a6178fc0c813 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomAction.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A custom action that can be performed with a Gallery Application + /// Version. + /// + public partial class GalleryApplicationCustomAction + { + /// + /// Initializes a new instance of the GalleryApplicationCustomAction + /// class. + /// + public GalleryApplicationCustomAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationCustomAction + /// class. + /// + /// The name of the custom action. Must be unique + /// within the Gallery Application Version. + /// The script to run when executing this custom + /// action. + /// Description to help the users understand + /// what this custom action does. + /// The parameters that this custom action + /// uses + public GalleryApplicationCustomAction(string name, string script, string description = default(string), IList parameters = default(IList)) + { + Name = name; + Script = script; + Description = description; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the custom action. Must be unique within + /// the Gallery Application Version. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the script to run when executing this custom action. + /// + [JsonProperty(PropertyName = "script")] + public string Script { get; set; } + + /// + /// Gets or sets description to help the users understand what this + /// custom action does. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the parameters that this custom action uses + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Script == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Script"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameter.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameter.cs new file mode 100644 index 000000000000..d648b8b98969 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameter.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The definition of a parameter that can be passed to a custom action of + /// a Gallery Application Version. + /// + public partial class GalleryApplicationCustomActionParameter + { + /// + /// Initializes a new instance of the + /// GalleryApplicationCustomActionParameter class. + /// + public GalleryApplicationCustomActionParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryApplicationCustomActionParameter class. + /// + /// The name of the custom action. Must be unique + /// within the Gallery Application Version. + /// Indicates whether this parameter must be + /// passed when running the custom action. + /// Specifies the type of the custom action + /// parameter. Possible values are: String, ConfigurationDataBlob or + /// LogOutputBlob. Possible values include: 'String', + /// 'ConfigurationDataBlob', 'LogOutputBlob' + /// The default value of the parameter. + /// Only applies to string types + /// A description to help users understand + /// what this parameter means + public GalleryApplicationCustomActionParameter(string name, bool? required = default(bool?), GalleryApplicationCustomActionParameterType? type = default(GalleryApplicationCustomActionParameterType?), string defaultValue = default(string), string description = default(string)) + { + Name = name; + Required = required; + Type = type; + DefaultValue = defaultValue; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the custom action. Must be unique within + /// the Gallery Application Version. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether this parameter must be passed when + /// running the custom action. + /// + [JsonProperty(PropertyName = "required")] + public bool? Required { get; set; } + + /// + /// Gets or sets specifies the type of the custom action parameter. + /// Possible values are: String, ConfigurationDataBlob or + /// LogOutputBlob. Possible values include: 'String', + /// 'ConfigurationDataBlob', 'LogOutputBlob' + /// + [JsonProperty(PropertyName = "type")] + public GalleryApplicationCustomActionParameterType? Type { get; set; } + + /// + /// Gets or sets the default value of the parameter. Only applies to + /// string types + /// + [JsonProperty(PropertyName = "defaultValue")] + public string DefaultValue { get; set; } + + /// + /// Gets or sets a description to help users understand what this + /// parameter means + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameterType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameterType.cs new file mode 100644 index 000000000000..0a63b3ebcddb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationCustomActionParameterType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for GalleryApplicationCustomActionParameterType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum GalleryApplicationCustomActionParameterType + { + [EnumMember(Value = "String")] + String, + [EnumMember(Value = "ConfigurationDataBlob")] + ConfigurationDataBlob, + [EnumMember(Value = "LogOutputBlob")] + LogOutputBlob + } + internal static class GalleryApplicationCustomActionParameterTypeEnumExtension + { + internal static string ToSerializedValue(this GalleryApplicationCustomActionParameterType? value) + { + return value == null ? null : ((GalleryApplicationCustomActionParameterType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this GalleryApplicationCustomActionParameterType value) + { + switch( value ) + { + case GalleryApplicationCustomActionParameterType.String: + return "String"; + case GalleryApplicationCustomActionParameterType.ConfigurationDataBlob: + return "ConfigurationDataBlob"; + case GalleryApplicationCustomActionParameterType.LogOutputBlob: + return "LogOutputBlob"; + } + return null; + } + + internal static GalleryApplicationCustomActionParameterType? ParseGalleryApplicationCustomActionParameterType(this string value) + { + switch( value ) + { + case "String": + return GalleryApplicationCustomActionParameterType.String; + case "ConfigurationDataBlob": + return GalleryApplicationCustomActionParameterType.ConfigurationDataBlob; + case "LogOutputBlob": + return GalleryApplicationCustomActionParameterType.LogOutputBlob; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationUpdate.cs new file mode 100644 index 000000000000..8ca99d559aef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationUpdate.cs @@ -0,0 +1,152 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery Application Definition that you + /// want to update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryApplicationUpdate class. + /// + public GalleryApplicationUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationUpdate class. + /// + /// This property allows you to specify + /// the supported type of the OS that application is built for. + /// <br><br> Possible values are: <br><br> + /// **Windows** <br><br> **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery + /// Application Definition resource. This property is + /// updatable. + /// The Eula agreement for the gallery Application + /// Definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The end of life date of the gallery + /// Application Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + /// A list of custom actions that can be + /// performed with all of the Gallery Application Versions within this + /// Gallery Application. + public GalleryApplicationUpdate(OperatingSystemTypes supportedOSType, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), IList customActions = default(IList)) + : base(id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + EndOfLifeDate = endOfLifeDate; + SupportedOSType = supportedOSType; + CustomActions = customActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery Application Definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery Application + /// Definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets the end of life date of the gallery Application + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets this property allows you to specify the supported type + /// of the OS that application is built for. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.supportedOSType")] + public OperatingSystemTypes SupportedOSType { get; set; } + + /// + /// Gets or sets a list of custom actions that can be performed with + /// all of the Gallery Application Versions within this Gallery + /// Application. + /// + [JsonProperty(PropertyName = "properties.customActions")] + public IList CustomActions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CustomActions != null) + { + foreach (var element in CustomActions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersion.cs new file mode 100644 index 000000000000..5ee29c949334 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersion.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery Application Version that you + /// want to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationVersion : Resource + { + /// + /// Initializes a new instance of the GalleryApplicationVersion class. + /// + public GalleryApplicationVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationVersion class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public GalleryApplicationVersion(string location, GalleryApplicationVersionPublishingProfile publishingProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryApplicationVersionSafetyProfile safetyProfile = default(GalleryApplicationVersionSafetyProfile), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(location, id, name, type, tags) + { + PublishingProfile = publishingProfile; + SafetyProfile = safetyProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryApplicationVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.safetyProfile")] + public GalleryApplicationVersionSafetyProfile SafetyProfile { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PublishingProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublishingProfile"); + } + if (PublishingProfile != null) + { + PublishingProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionPublishingProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionPublishingProfile.cs new file mode 100644 index 000000000000..25a5c2bc6b8e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionPublishingProfile.cs @@ -0,0 +1,154 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The publishing profile of a gallery image version. + /// + public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionPublishingProfile class. + /// + public GalleryApplicationVersionPublishingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionPublishingProfile class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// deployed from the latest version of the Image Definition won't use + /// this Image Version. + /// The timestamp for when the gallery + /// image version is published. + /// The end of life date of the gallery + /// image version. This property can be used for decommissioning + /// purposes. This property is updatable. + /// Specifies the storage account type + /// to be used to store the image. This property is not updatable. + /// Possible values include: 'Standard_LRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// Optional parameter which specifies + /// the mode to be used for replication. This property is not + /// updatable. Possible values include: 'Full', 'Shallow' + /// The target extended locations + /// where the Image Version is going to be replicated to. This property + /// is updatable. + /// Optional. Additional settings to + /// pass to the vm-application-manager extension. For advanced use + /// only. + /// Optional. Whether or not this + /// application reports health. + /// A list of custom actions that can be + /// performed with this Gallery Application Version. + public GalleryApplicationVersionPublishingProfile(UserArtifactSource source, IList targetRegions = default(IList), int? replicaCount = default(int?), bool? excludeFromLatest = default(bool?), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), string storageAccountType = default(string), string replicationMode = default(string), IList targetExtendedLocations = default(IList), UserArtifactManage manageActions = default(UserArtifactManage), UserArtifactSettings settings = default(UserArtifactSettings), IDictionary advancedSettings = default(IDictionary), bool? enableHealthCheck = default(bool?), IList customActions = default(IList)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType, replicationMode, targetExtendedLocations) + { + Source = source; + ManageActions = manageActions; + Settings = settings; + AdvancedSettings = advancedSettings; + EnableHealthCheck = enableHealthCheck; + CustomActions = customActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "source")] + public UserArtifactSource Source { get; set; } + + /// + /// + [JsonProperty(PropertyName = "manageActions")] + public UserArtifactManage ManageActions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "settings")] + public UserArtifactSettings Settings { get; set; } + + /// + /// Gets or sets optional. Additional settings to pass to the + /// vm-application-manager extension. For advanced use only. + /// + [JsonProperty(PropertyName = "advancedSettings")] + public IDictionary AdvancedSettings { get; set; } + + /// + /// Gets or sets optional. Whether or not this application reports + /// health. + /// + [JsonProperty(PropertyName = "enableHealthCheck")] + public bool? EnableHealthCheck { get; set; } + + /// + /// Gets or sets a list of custom actions that can be performed with + /// this Gallery Application Version. + /// + [JsonProperty(PropertyName = "customActions")] + public IList CustomActions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Source == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Source"); + } + if (Source != null) + { + Source.Validate(); + } + if (ManageActions != null) + { + ManageActions.Validate(); + } + if (CustomActions != null) + { + foreach (var element in CustomActions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionSafetyProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionSafetyProfile.cs new file mode 100644 index 000000000000..b9b05b5032cc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionSafetyProfile.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// The safety profile of the Gallery Application Version. + /// + public partial class GalleryApplicationVersionSafetyProfile : GalleryArtifactSafetyProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionSafetyProfile class. + /// + public GalleryApplicationVersionSafetyProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryApplicationVersionSafetyProfile class. + /// + /// Indicates whether + /// or not removing this Gallery Image Version from replicated regions + /// is allowed. + public GalleryApplicationVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations = default(bool?)) + : base(allowDeletionOfReplicatedLocations) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionUpdate.cs new file mode 100644 index 000000000000..3c6b3c2b4605 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryApplicationVersionUpdate.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery Application Version that you + /// want to update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryApplicationVersionUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryApplicationVersionUpdate + /// class. + /// + public GalleryApplicationVersionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryApplicationVersionUpdate + /// class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public GalleryApplicationVersionUpdate(GalleryApplicationVersionPublishingProfile publishingProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryApplicationVersionSafetyProfile safetyProfile = default(GalleryApplicationVersionSafetyProfile), string provisioningState = default(string), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(id, name, type, tags) + { + PublishingProfile = publishingProfile; + SafetyProfile = safetyProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryApplicationVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.safetyProfile")] + public GalleryApplicationVersionSafetyProfile SafetyProfile { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PublishingProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublishingProfile"); + } + if (PublishingProfile != null) + { + PublishingProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactPublishingProfileBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactPublishingProfileBase.cs new file mode 100644 index 000000000000..c9c643e788df --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactPublishingProfileBase.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the basic gallery artifact publishing profile. + /// + public partial class GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryArtifactPublishingProfileBase class. + /// + public GalleryArtifactPublishingProfileBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryArtifactPublishingProfileBase class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// deployed from the latest version of the Image Definition won't use + /// this Image Version. + /// The timestamp for when the gallery + /// image version is published. + /// The end of life date of the gallery + /// image version. This property can be used for decommissioning + /// purposes. This property is updatable. + /// Specifies the storage account type + /// to be used to store the image. This property is not updatable. + /// Possible values include: 'Standard_LRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// Optional parameter which specifies + /// the mode to be used for replication. This property is not + /// updatable. Possible values include: 'Full', 'Shallow' + /// The target extended locations + /// where the Image Version is going to be replicated to. This property + /// is updatable. + public GalleryArtifactPublishingProfileBase(IList targetRegions = default(IList), int? replicaCount = default(int?), bool? excludeFromLatest = default(bool?), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), string storageAccountType = default(string), string replicationMode = default(string), IList targetExtendedLocations = default(IList)) + { + TargetRegions = targetRegions; + ReplicaCount = replicaCount; + ExcludeFromLatest = excludeFromLatest; + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + StorageAccountType = storageAccountType; + ReplicationMode = replicationMode; + TargetExtendedLocations = targetExtendedLocations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target regions where the Image Version is going to + /// be replicated to. This property is updatable. + /// + [JsonProperty(PropertyName = "targetRegions")] + public IList TargetRegions { get; set; } + + /// + /// Gets or sets the number of replicas of the Image Version to be + /// created per region. This property would take effect for a region + /// when regionalReplicaCount is not specified. This property is + /// updatable. + /// + [JsonProperty(PropertyName = "replicaCount")] + public int? ReplicaCount { get; set; } + + /// + /// Gets or sets if set to true, Virtual Machines deployed from the + /// latest version of the Image Definition won't use this Image + /// Version. + /// + [JsonProperty(PropertyName = "excludeFromLatest")] + public bool? ExcludeFromLatest { get; set; } + + /// + /// Gets the timestamp for when the gallery image version is published. + /// + [JsonProperty(PropertyName = "publishedDate")] + public System.DateTime? PublishedDate { get; private set; } + + /// + /// Gets or sets the end of life date of the gallery image version. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets specifies the storage account type to be used to store + /// the image. This property is not updatable. Possible values include: + /// 'Standard_LRS', 'Standard_ZRS', 'Premium_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets optional parameter which specifies the mode to be used + /// for replication. This property is not updatable. Possible values + /// include: 'Full', 'Shallow' + /// + [JsonProperty(PropertyName = "replicationMode")] + public string ReplicationMode { get; set; } + + /// + /// Gets or sets the target extended locations where the Image Version + /// is going to be replicated to. This property is updatable. + /// + [JsonProperty(PropertyName = "targetExtendedLocations")] + public IList TargetExtendedLocations { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSafetyProfileBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSafetyProfileBase.cs new file mode 100644 index 000000000000..0a28b357a54c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSafetyProfileBase.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the safety profile of the Gallery Artifact Version. + /// + public partial class GalleryArtifactSafetyProfileBase + { + /// + /// Initializes a new instance of the GalleryArtifactSafetyProfileBase + /// class. + /// + public GalleryArtifactSafetyProfileBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactSafetyProfileBase + /// class. + /// + /// Indicates whether + /// or not removing this Gallery Image Version from replicated regions + /// is allowed. + public GalleryArtifactSafetyProfileBase(bool? allowDeletionOfReplicatedLocations = default(bool?)) + { + AllowDeletionOfReplicatedLocations = allowDeletionOfReplicatedLocations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether or not removing this Gallery Image + /// Version from replicated regions is allowed. + /// + [JsonProperty(PropertyName = "allowDeletionOfReplicatedLocations")] + public bool? AllowDeletionOfReplicatedLocations { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSource.cs new file mode 100644 index 000000000000..1419a0c08ed0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactSource.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image from which the Image Version is going to be created. + /// + public partial class GalleryArtifactSource + { + /// + /// Initializes a new instance of the GalleryArtifactSource class. + /// + public GalleryArtifactSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactSource class. + /// + public GalleryArtifactSource(ManagedArtifact managedImage) + { + ManagedImage = managedImage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "managedImage")] + public ManagedArtifact ManagedImage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ManagedImage"); + } + if (ManagedImage != null) + { + ManagedImage.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionFullSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionFullSource.cs new file mode 100644 index 000000000000..ec186dabb581 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionFullSource.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source of the gallery artifact version. + /// + public partial class GalleryArtifactVersionFullSource : GalleryArtifactVersionSource + { + /// + /// Initializes a new instance of the GalleryArtifactVersionFullSource + /// class. + /// + public GalleryArtifactVersionFullSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactVersionFullSource + /// class. + /// + /// The id of the gallery artifact version source. Can + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. + /// The resource Id of the source + /// Community Gallery Image. Only required when using Community + /// Gallery Image as a source. + public GalleryArtifactVersionFullSource(string id = default(string), string communityGalleryImageId = default(string)) + : base(id) + { + CommunityGalleryImageId = communityGalleryImageId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource Id of the source Community Gallery Image. + /// Only required when using Community Gallery Image as a source. + /// + [JsonProperty(PropertyName = "communityGalleryImageId")] + public string CommunityGalleryImageId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionSource.cs new file mode 100644 index 000000000000..baa59334f2ab --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryArtifactVersionSource.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The gallery artifact version source. + /// + public partial class GalleryArtifactVersionSource + { + /// + /// Initializes a new instance of the GalleryArtifactVersionSource + /// class. + /// + public GalleryArtifactVersionSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryArtifactVersionSource + /// class. + /// + /// The id of the gallery artifact version source. Can + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. + public GalleryArtifactVersionSource(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the gallery artifact version source. Can + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDataDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDataDiskImage.cs new file mode 100644 index 000000000000..e82d5fb31abc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDataDiskImage.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the data disk image. + /// + public partial class GalleryDataDiskImage : GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryDataDiskImage class. + /// + public GalleryDataDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryDataDiskImage class. + /// + /// This property specifies the logical unit number + /// of the data disk. This value is used to identify data disks within + /// the Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryDataDiskImage(int lun, int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryDiskImageSource source = default(GalleryDiskImageSource)) + : base(sizeInGB, hostCaching, source) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the logical unit number of the + /// data disk. This value is used to identify data disks within the + /// Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImage.cs new file mode 100644 index 000000000000..d8b0768b28f3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImage.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the disk image base class. + /// + public partial class GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryDiskImage class. + /// + public GalleryDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryDiskImage class. + /// + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryDiskImage(int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryDiskImageSource source = default(GalleryDiskImageSource)) + { + SizeInGB = sizeInGB; + HostCaching = hostCaching; + Source = source; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this property indicates the size of the VHD to be created. + /// + [JsonProperty(PropertyName = "sizeInGB")] + public int? SizeInGB { get; private set; } + + /// + /// Gets or sets the host caching of the disk. Valid values are 'None', + /// 'ReadOnly', and 'ReadWrite'. Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "hostCaching")] + public HostCaching? HostCaching { get; set; } + + /// + /// + [JsonProperty(PropertyName = "source")] + public GalleryDiskImageSource Source { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImageSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImageSource.cs new file mode 100644 index 000000000000..6e39cb4745e4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryDiskImageSource.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source for the disk image. + /// + public partial class GalleryDiskImageSource : GalleryArtifactVersionSource + { + /// + /// Initializes a new instance of the GalleryDiskImageSource class. + /// + public GalleryDiskImageSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryDiskImageSource class. + /// + /// The id of the gallery artifact version source. Can + /// specify a disk uri, snapshot uri, user image or storage account + /// resource. + /// The uri of the gallery artifact version source. + /// Currently used to specify vhd/blob source. + /// The Storage Account Id that contains + /// the vhd blob being used as a source for this artifact + /// version. + public GalleryDiskImageSource(string id = default(string), string uri = default(string), string storageAccountId = default(string)) + : base(id) + { + Uri = uri; + StorageAccountId = storageAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the uri of the gallery artifact version source. + /// Currently used to specify vhd/blob source. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + /// + /// Gets or sets the Storage Account Id that contains the vhd blob + /// being used as a source for this artifact version. + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExpandParams.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExpandParams.cs new file mode 100644 index 000000000000..4ac1f1ff5567 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExpandParams.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for GalleryExpandParams. + /// + public static class GalleryExpandParams + { + public const string SharingProfileGroups = "SharingProfile/Groups"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocation.cs new file mode 100644 index 000000000000..3953136aabc8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocation.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The name of the extended location. + /// + public partial class GalleryExtendedLocation + { + /// + /// Initializes a new instance of the GalleryExtendedLocation class. + /// + public GalleryExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryExtendedLocation class. + /// + /// Possible values include: 'EdgeZone', + /// 'Unknown' + public GalleryExtendedLocation(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets possible values include: 'EdgeZone', 'Unknown' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocationType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocationType.cs new file mode 100644 index 000000000000..1a1e331bff8a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryExtendedLocationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for GalleryExtendedLocationType. + /// + public static class GalleryExtendedLocationType + { + public const string EdgeZone = "EdgeZone"; + public const string Unknown = "Unknown"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryIdentifier.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryIdentifier.cs new file mode 100644 index 000000000000..37791d8d2e02 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryIdentifier.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the gallery unique name. + /// + public partial class GalleryIdentifier + { + /// + /// Initializes a new instance of the GalleryIdentifier class. + /// + public GalleryIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryIdentifier class. + /// + /// The unique name of the Shared Image + /// Gallery. This name is generated automatically by Azure. + public GalleryIdentifier(string uniqueName = default(string)) + { + UniqueName = uniqueName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique name of the Shared Image Gallery. This name is + /// generated automatically by Azure. + /// + [JsonProperty(PropertyName = "uniqueName")] + public string UniqueName { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImage.cs new file mode 100644 index 000000000000..afffbc09fa1f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImage.cs @@ -0,0 +1,215 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImage : Resource + { + /// + /// Initializes a new instance of the GalleryImage class. + /// + public GalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImage class. + /// + /// Resource location + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery image + /// definition resource. This property is updatable. + /// The Eula agreement for the gallery image + /// definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + /// A list of gallery image features. + /// Possible values include: 'x64', + /// 'Arm64' + public GalleryImage(string location, OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string), IList features = default(IList), string architecture = default(string)) + : base(location, id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + OsType = osType; + OsState = osState; + HyperVGeneration = hyperVGeneration; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + PurchasePlan = purchasePlan; + ProvisioningState = provisioningState; + Features = features; + Architecture = architecture; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery image definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery image definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// Gets or sets possible values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "properties.architecture")] + public string Architecture { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageFeature.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageFeature.cs new file mode 100644 index 000000000000..2aa52c29b60b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageFeature.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A feature for gallery image. + /// + public partial class GalleryImageFeature + { + /// + /// Initializes a new instance of the GalleryImageFeature class. + /// + public GalleryImageFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageFeature class. + /// + /// The name of the gallery image feature. + /// The value of the gallery image feature. + public GalleryImageFeature(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the gallery image feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the gallery image feature. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageIdentifier.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageIdentifier.cs new file mode 100644 index 000000000000..5f3835b6879f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageIdentifier.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the gallery image definition identifier. + /// + public partial class GalleryImageIdentifier + { + /// + /// Initializes a new instance of the GalleryImageIdentifier class. + /// + public GalleryImageIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageIdentifier class. + /// + /// The name of the gallery image definition + /// publisher. + /// The name of the gallery image definition + /// offer. + /// The name of the gallery image definition + /// SKU. + public GalleryImageIdentifier(string publisher, string offer, string sku) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the gallery image definition publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the name of the gallery image definition offer. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the name of the gallery image definition SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Offer"); + } + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageUpdate.cs new file mode 100644 index 000000000000..b1c06caaa839 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageUpdate.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryImageUpdate class. + /// + public GalleryImageUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageUpdate class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this gallery image + /// definition resource. This property is updatable. + /// The Eula agreement for the gallery image + /// definition. + /// The privacy statement + /// uri. + /// The release note uri. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + /// A list of gallery image features. + /// Possible values include: 'x64', + /// 'Arm64' + public GalleryImageUpdate(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string eula = default(string), string privacyStatementUri = default(string), string releaseNoteUri = default(string), string hyperVGeneration = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string provisioningState = default(string), IList features = default(IList), string architecture = default(string)) + : base(id, name, type, tags) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + OsType = osType; + OsState = osState; + HyperVGeneration = hyperVGeneration; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + PurchasePlan = purchasePlan; + ProvisioningState = provisioningState; + Features = features; + Architecture = architecture; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this gallery image definition + /// resource. This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Eula agreement for the gallery image definition. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Gets or sets the privacy statement uri. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets the release note uri. + /// + [JsonProperty(PropertyName = "properties.releaseNoteUri")] + public string ReleaseNoteUri { get; set; } + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// Gets or sets possible values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "properties.architecture")] + public string Architecture { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersion.cs new file mode 100644 index 000000000000..edb88b28fdbb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersion.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageVersion : Resource + { + /// + /// Initializes a new instance of the GalleryImageVersion class. + /// + public GalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersion class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public GalleryImageVersion(string location, GalleryImageVersionStorageProfile storageProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryImageVersionPublishingProfile publishingProfile = default(GalleryImageVersionPublishingProfile), string provisioningState = default(string), GalleryImageVersionSafetyProfile safetyProfile = default(GalleryImageVersionSafetyProfile), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(location, id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + SafetyProfile = safetyProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public GalleryImageVersionStorageProfile StorageProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.safetyProfile")] + public GalleryImageVersionSafetyProfile SafetyProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageProfile"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionPublishingProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionPublishingProfile.cs new file mode 100644 index 000000000000..b7eb7ddf28eb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionPublishingProfile.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The publishing profile of a gallery image Version. + /// + public partial class GalleryImageVersionPublishingProfile : GalleryArtifactPublishingProfileBase + { + /// + /// Initializes a new instance of the + /// GalleryImageVersionPublishingProfile class. + /// + public GalleryImageVersionPublishingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GalleryImageVersionPublishingProfile class. + /// + /// The target regions where the Image + /// Version is going to be replicated to. This property is + /// updatable. + /// The number of replicas of the Image + /// Version to be created per region. This property would take effect + /// for a region when regionalReplicaCount is not specified. This + /// property is updatable. + /// If set to true, Virtual Machines + /// deployed from the latest version of the Image Definition won't use + /// this Image Version. + /// The timestamp for when the gallery + /// image version is published. + /// The end of life date of the gallery + /// image version. This property can be used for decommissioning + /// purposes. This property is updatable. + /// Specifies the storage account type + /// to be used to store the image. This property is not updatable. + /// Possible values include: 'Standard_LRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// Optional parameter which specifies + /// the mode to be used for replication. This property is not + /// updatable. Possible values include: 'Full', 'Shallow' + /// The target extended locations + /// where the Image Version is going to be replicated to. This property + /// is updatable. + public GalleryImageVersionPublishingProfile(IList targetRegions = default(IList), int? replicaCount = default(int?), bool? excludeFromLatest = default(bool?), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), string storageAccountType = default(string), string replicationMode = default(string), IList targetExtendedLocations = default(IList)) + : base(targetRegions, replicaCount, excludeFromLatest, publishedDate, endOfLifeDate, storageAccountType, replicationMode, targetExtendedLocations) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionSafetyProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionSafetyProfile.cs new file mode 100644 index 000000000000..c4dc2a6f2812 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionSafetyProfile.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This is the safety profile of the Gallery Image Version. + /// + public partial class GalleryImageVersionSafetyProfile : GalleryArtifactSafetyProfileBase + { + /// + /// Initializes a new instance of the GalleryImageVersionSafetyProfile + /// class. + /// + public GalleryImageVersionSafetyProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersionSafetyProfile + /// class. + /// + /// Indicates whether + /// or not removing this Gallery Image Version from replicated regions + /// is allowed. + /// Indicates whether this + /// image has been reported as violating Microsoft's policies. + /// A list of Policy Violations that + /// have been reported for this Gallery Image Version. + public GalleryImageVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations = default(bool?), bool? reportedForPolicyViolation = default(bool?), IList policyViolations = default(IList)) + : base(allowDeletionOfReplicatedLocations) + { + ReportedForPolicyViolation = reportedForPolicyViolation; + PolicyViolations = policyViolations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets indicates whether this image has been reported as violating + /// Microsoft's policies. + /// + [JsonProperty(PropertyName = "reportedForPolicyViolation")] + public bool? ReportedForPolicyViolation { get; private set; } + + /// + /// Gets a list of Policy Violations that have been reported for this + /// Gallery Image Version. + /// + [JsonProperty(PropertyName = "policyViolations")] + public IList PolicyViolations { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionStorageProfile.cs new file mode 100644 index 000000000000..11eb18005aae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionStorageProfile.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This is the storage profile of a Gallery Image Version. + /// + public partial class GalleryImageVersionStorageProfile + { + /// + /// Initializes a new instance of the GalleryImageVersionStorageProfile + /// class. + /// + public GalleryImageVersionStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersionStorageProfile + /// class. + /// + /// A list of data disk images. + public GalleryImageVersionStorageProfile(GalleryArtifactVersionFullSource source = default(GalleryArtifactVersionFullSource), GalleryOSDiskImage osDiskImage = default(GalleryOSDiskImage), IList dataDiskImages = default(IList)) + { + Source = source; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "source")] + public GalleryArtifactVersionFullSource Source { get; set; } + + /// + /// + [JsonProperty(PropertyName = "osDiskImage")] + public GalleryOSDiskImage OsDiskImage { get; set; } + + /// + /// Gets or sets a list of data disk images. + /// + [JsonProperty(PropertyName = "dataDiskImages")] + public IList DataDiskImages { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionUpdate.cs new file mode 100644 index 000000000000..99e78b8d0b2f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryImageVersionUpdate.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryImageVersionUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryImageVersionUpdate class. + /// + public GalleryImageVersionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryImageVersionUpdate class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public GalleryImageVersionUpdate(GalleryImageVersionStorageProfile storageProfile, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), GalleryImageVersionPublishingProfile publishingProfile = default(GalleryImageVersionPublishingProfile), string provisioningState = default(string), GalleryImageVersionSafetyProfile safetyProfile = default(GalleryImageVersionSafetyProfile), ReplicationStatus replicationStatus = default(ReplicationStatus)) + : base(id, name, type, tags) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + SafetyProfile = safetyProfile; + ReplicationStatus = replicationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.publishingProfile")] + public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public GalleryImageVersionStorageProfile StorageProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.safetyProfile")] + public GalleryImageVersionSafetyProfile SafetyProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.replicationStatus")] + public ReplicationStatus ReplicationStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageProfile"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryOSDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryOSDiskImage.cs new file mode 100644 index 000000000000..ebfdc5930db6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryOSDiskImage.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// This is the OS disk image. + /// + public partial class GalleryOSDiskImage : GalleryDiskImage + { + /// + /// Initializes a new instance of the GalleryOSDiskImage class. + /// + public GalleryOSDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryOSDiskImage class. + /// + /// This property indicates the size of the VHD + /// to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public GalleryOSDiskImage(int? sizeInGB = default(int?), HostCaching? hostCaching = default(HostCaching?), GalleryDiskImageSource source = default(GalleryDiskImageSource)) + : base(sizeInGB, hostCaching, source) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryProvisioningState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryProvisioningState.cs new file mode 100644 index 000000000000..41b216b9ce3f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryProvisioningState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for GalleryProvisioningState. + /// + public static class GalleryProvisioningState + { + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string Deleting = "Deleting"; + public const string Migrating = "Migrating"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GallerySharingPermissionTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GallerySharingPermissionTypes.cs new file mode 100644 index 000000000000..ae86b1d43aa6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GallerySharingPermissionTypes.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for GallerySharingPermissionTypes. + /// + public static class GallerySharingPermissionTypes + { + public const string Private = "Private"; + public const string Groups = "Groups"; + public const string Community = "Community"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryTargetExtendedLocation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryTargetExtendedLocation.cs new file mode 100644 index 000000000000..e352c10ef68d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryTargetExtendedLocation.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class GalleryTargetExtendedLocation + { + /// + /// Initializes a new instance of the GalleryTargetExtendedLocation + /// class. + /// + public GalleryTargetExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryTargetExtendedLocation + /// class. + /// + /// The name of the region. + /// The number of replicas + /// of the Image Version to be created per extended location. This + /// property is updatable. + /// Specifies the storage account type + /// to be used to store the image. This property is not updatable. + /// Possible values include: 'Standard_LRS', 'Standard_ZRS', + /// 'StandardSSD_LRS', 'Premium_LRS' + public GalleryTargetExtendedLocation(string name = default(string), GalleryExtendedLocation extendedLocation = default(GalleryExtendedLocation), int? extendedLocationReplicaCount = default(int?), string storageAccountType = default(string), EncryptionImages encryption = default(EncryptionImages)) + { + Name = name; + ExtendedLocation = extendedLocation; + ExtendedLocationReplicaCount = extendedLocationReplicaCount; + StorageAccountType = storageAccountType; + Encryption = encryption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the region. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedLocation")] + public GalleryExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets the number of replicas of the Image Version to be + /// created per extended location. This property is updatable. + /// + [JsonProperty(PropertyName = "extendedLocationReplicaCount")] + public int? ExtendedLocationReplicaCount { get; set; } + + /// + /// Gets or sets specifies the storage account type to be used to store + /// the image. This property is not updatable. Possible values include: + /// 'Standard_LRS', 'Standard_ZRS', 'StandardSSD_LRS', 'Premium_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "encryption")] + public EncryptionImages Encryption { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryUpdate.cs new file mode 100644 index 000000000000..268f3d966eb9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GalleryUpdate.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the Shared Image Gallery that you want to + /// update. + /// + [Rest.Serialization.JsonTransformation] + public partial class GalleryUpdate : UpdateResourceDefinition + { + /// + /// Initializes a new instance of the GalleryUpdate class. + /// + public GalleryUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GalleryUpdate class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The description of this Shared Image + /// Gallery resource. This property is updatable. + /// Possible values include: + /// 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', + /// 'Migrating' + public GalleryUpdate(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), GalleryIdentifier identifier = default(GalleryIdentifier), string provisioningState = default(string), SharingProfile sharingProfile = default(SharingProfile), SoftDeletePolicy softDeletePolicy = default(SoftDeletePolicy), SharingStatus sharingStatus = default(SharingStatus)) + : base(id, name, type, tags) + { + Description = description; + Identifier = identifier; + ProvisioningState = provisioningState; + SharingProfile = sharingProfile; + SoftDeletePolicy = softDeletePolicy; + SharingStatus = sharingStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of this Shared Image Gallery resource. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryIdentifier Identifier { get; set; } + + /// + /// Gets possible values include: 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingProfile")] + public SharingProfile SharingProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.softDeletePolicy")] + public SoftDeletePolicy SoftDeletePolicy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.sharingStatus")] + public SharingStatus SharingStatus { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/GrantAccessData.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/GrantAccessData.cs new file mode 100644 index 000000000000..8f66eabdad7a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/GrantAccessData.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data used for requesting a SAS. + /// + public partial class GrantAccessData + { + /// + /// Initializes a new instance of the GrantAccessData class. + /// + public GrantAccessData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GrantAccessData class. + /// + /// Possible values include: 'None', 'Read', + /// 'Write' + /// Time duration in seconds until the + /// SAS access expires. + /// Set this flag to true to get + /// additional SAS for VM guest state + /// Used to specify the file format when + /// making request for SAS on a VHDX file format snapshot. Possible + /// values include: 'VHD', 'VHDX' + public GrantAccessData(string access, int durationInSeconds, bool? getSecureVMGuestStateSAS = default(bool?), string fileFormat = default(string)) + { + Access = access; + DurationInSeconds = durationInSeconds; + GetSecureVMGuestStateSAS = getSecureVMGuestStateSAS; + FileFormat = fileFormat; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'None', 'Read', 'Write' + /// + [JsonProperty(PropertyName = "access")] + public string Access { get; set; } + + /// + /// Gets or sets time duration in seconds until the SAS access expires. + /// + [JsonProperty(PropertyName = "durationInSeconds")] + public int DurationInSeconds { get; set; } + + /// + /// Gets or sets set this flag to true to get additional SAS for VM + /// guest state + /// + [JsonProperty(PropertyName = "getSecureVMGuestStateSAS")] + public bool? GetSecureVMGuestStateSAS { get; set; } + + /// + /// Gets or sets used to specify the file format when making request + /// for SAS on a VHDX file format snapshot. Possible values include: + /// 'VHD', 'VHDX' + /// + [JsonProperty(PropertyName = "fileFormat")] + public string FileFormat { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Access == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Access"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/HardwareProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/HardwareProfile.cs new file mode 100644 index 000000000000..1ece1b9c2bf1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/HardwareProfile.cs @@ -0,0 +1,194 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the hardware settings for the virtual machine. + /// + public partial class HardwareProfile + { + /// + /// Initializes a new instance of the HardwareProfile class. + /// + public HardwareProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HardwareProfile class. + /// + /// Specifies the size of the virtual machine. The + /// enum data type is currently deprecated and will be removed by + /// December 23rd 2023. The recommended way to get the list of + /// available sizes is using these APIs: [List all available virtual + /// machine sizes in an availability + /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes), + /// [List all available virtual machine sizes in a region]( + /// https://docs.microsoft.com/rest/api/compute/resourceskus/list), + /// [List all available virtual machine sizes for + /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/sizes). + /// The available VM sizes depend on region and availability set. + /// Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', + /// 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', + /// 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', + /// 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', + /// 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', + /// 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', + /// 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_B1s', + /// 'Standard_B1ms', 'Standard_B2s', 'Standard_B2ms', 'Standard_B4ms', + /// 'Standard_B8ms', 'Standard_D1', 'Standard_D2', 'Standard_D3', + /// 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', + /// 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', + /// 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', + /// 'Standard_D2_v3', 'Standard_D4_v3', 'Standard_D8_v3', + /// 'Standard_D16_v3', 'Standard_D32_v3', 'Standard_D64_v3', + /// 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', + /// 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', + /// 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', + /// 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', + /// 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', + /// 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', + /// 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', + /// 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', + /// 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', + /// 'Standard_DS15_v2', 'Standard_DS13-4_v2', 'Standard_DS13-2_v2', + /// 'Standard_DS14-8_v2', 'Standard_DS14-4_v2', 'Standard_E2_v3', + /// 'Standard_E4_v3', 'Standard_E8_v3', 'Standard_E16_v3', + /// 'Standard_E32_v3', 'Standard_E64_v3', 'Standard_E2s_v3', + /// 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', + /// 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_E32-16_v3', + /// 'Standard_E32-8s_v3', 'Standard_E64-32s_v3', 'Standard_E64-16s_v3', + /// 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', + /// 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', + /// 'Standard_F8s', 'Standard_F16s', 'Standard_F2s_v2', + /// 'Standard_F4s_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + /// 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5', 'Standard_GS4-8', 'Standard_GS4-4', + /// 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H8', 'Standard_H16', + /// 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', + /// 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', + /// 'Standard_M64s', 'Standard_M64ms', 'Standard_M128s', + /// 'Standard_M128ms', 'Standard_M64-32ms', 'Standard_M64-16ms', + /// 'Standard_M128-64ms', 'Standard_M128-32ms', 'Standard_NC6', + /// 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', + /// 'Standard_NC6s_v2', 'Standard_NC12s_v2', 'Standard_NC24s_v2', + /// 'Standard_NC24rs_v2', 'Standard_NC6s_v3', 'Standard_NC12s_v3', + /// 'Standard_NC24s_v3', 'Standard_NC24rs_v3', 'Standard_ND6s', + /// 'Standard_ND12s', 'Standard_ND24s', 'Standard_ND24rs', + /// 'Standard_NV6', 'Standard_NV12', 'Standard_NV24' + /// Specifies the properties for + /// customizing the size of the virtual machine. Minimum api-version: + /// 2021-07-01. This feature is still in preview mode and is not + /// supported for VirtualMachineScaleSet. Please follow the + /// instructions in [VM Customization](https://aka.ms/vmcustomization) + /// for more details. + public HardwareProfile(string vmSize = default(string), VMSizeProperties vmSizeProperties = default(VMSizeProperties)) + { + VmSize = vmSize; + VmSizeProperties = vmSizeProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the size of the virtual machine. The enum + /// data type is currently deprecated and will be removed by December + /// 23rd 2023. The recommended way to get the list of available sizes + /// is using these APIs: [List all available virtual machine sizes in + /// an availability + /// set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes), + /// [List all available virtual machine sizes in a region]( + /// https://docs.microsoft.com/rest/api/compute/resourceskus/list), + /// [List all available virtual machine sizes for + /// resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + /// For more information about virtual machine sizes, see [Sizes for + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/sizes). + /// The available VM sizes depend on region and availability set. + /// Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', + /// 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', + /// 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', + /// 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', + /// 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', + /// 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', + /// 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_B1s', + /// 'Standard_B1ms', 'Standard_B2s', 'Standard_B2ms', 'Standard_B4ms', + /// 'Standard_B8ms', 'Standard_D1', 'Standard_D2', 'Standard_D3', + /// 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', + /// 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', + /// 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', + /// 'Standard_D2_v3', 'Standard_D4_v3', 'Standard_D8_v3', + /// 'Standard_D16_v3', 'Standard_D32_v3', 'Standard_D64_v3', + /// 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', + /// 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', + /// 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', + /// 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', + /// 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', + /// 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', + /// 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', + /// 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', + /// 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', + /// 'Standard_DS15_v2', 'Standard_DS13-4_v2', 'Standard_DS13-2_v2', + /// 'Standard_DS14-8_v2', 'Standard_DS14-4_v2', 'Standard_E2_v3', + /// 'Standard_E4_v3', 'Standard_E8_v3', 'Standard_E16_v3', + /// 'Standard_E32_v3', 'Standard_E64_v3', 'Standard_E2s_v3', + /// 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', + /// 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_E32-16_v3', + /// 'Standard_E32-8s_v3', 'Standard_E64-32s_v3', 'Standard_E64-16s_v3', + /// 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', + /// 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', + /// 'Standard_F8s', 'Standard_F16s', 'Standard_F2s_v2', + /// 'Standard_F4s_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + /// 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + /// 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + /// 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + /// 'Standard_GS4', 'Standard_GS5', 'Standard_GS4-8', 'Standard_GS4-4', + /// 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H8', 'Standard_H16', + /// 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', + /// 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', + /// 'Standard_M64s', 'Standard_M64ms', 'Standard_M128s', + /// 'Standard_M128ms', 'Standard_M64-32ms', 'Standard_M64-16ms', + /// 'Standard_M128-64ms', 'Standard_M128-32ms', 'Standard_NC6', + /// 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', + /// 'Standard_NC6s_v2', 'Standard_NC12s_v2', 'Standard_NC24s_v2', + /// 'Standard_NC24rs_v2', 'Standard_NC6s_v3', 'Standard_NC12s_v3', + /// 'Standard_NC24s_v3', 'Standard_NC24rs_v3', 'Standard_ND6s', + /// 'Standard_ND12s', 'Standard_ND24s', 'Standard_ND24rs', + /// 'Standard_NV6', 'Standard_NV12', 'Standard_NV24' + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets specifies the properties for customizing the size of + /// the virtual machine. Minimum api-version: 2021-07-01. This feature + /// is still in preview mode and is not supported for + /// VirtualMachineScaleSet. Please follow the instructions in [VM + /// Customization](https://aka.ms/vmcustomization) for more details. + /// + [JsonProperty(PropertyName = "vmSizeProperties")] + public VMSizeProperties VmSizeProperties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/HostCaching.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/HostCaching.cs new file mode 100644 index 000000000000..c140f5462331 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/HostCaching.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for HostCaching. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum HostCaching + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "ReadOnly")] + ReadOnly, + [EnumMember(Value = "ReadWrite")] + ReadWrite + } + internal static class HostCachingEnumExtension + { + internal static string ToSerializedValue(this HostCaching? value) + { + return value == null ? null : ((HostCaching)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this HostCaching value) + { + switch( value ) + { + case HostCaching.None: + return "None"; + case HostCaching.ReadOnly: + return "ReadOnly"; + case HostCaching.ReadWrite: + return "ReadWrite"; + } + return null; + } + + internal static HostCaching? ParseHostCaching(this string value) + { + switch( value ) + { + case "None": + return HostCaching.None; + case "ReadOnly": + return HostCaching.ReadOnly; + case "ReadWrite": + return HostCaching.ReadWrite; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGeneration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGeneration.cs new file mode 100644 index 000000000000..569343631696 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGeneration.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for HyperVGeneration. + /// + public static class HyperVGeneration + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationType.cs new file mode 100644 index 000000000000..d8e6cbcd3646 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for HyperVGenerationType. + /// + public static class HyperVGenerationType + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationTypes.cs new file mode 100644 index 000000000000..50b687302386 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/HyperVGenerationTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for HyperVGenerationTypes. + /// + public static class HyperVGenerationTypes + { + public const string V1 = "V1"; + public const string V2 = "V2"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersion.cs new file mode 100644 index 000000000000..b084ca6e2b50 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersion.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for IPVersion. + /// + public static class IPVersion + { + public const string IPv4 = "IPv4"; + public const string IPv6 = "IPv6"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersions.cs new file mode 100644 index 000000000000..0cbb3a97bcd4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/IPVersions.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for IPVersions. + /// + public static class IPVersions + { + public const string IPv4 = "IPv4"; + public const string IPv6 = "IPv6"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Image.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Image.cs new file mode 100644 index 000000000000..c844f7a144af --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Image.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + [Rest.Serialization.JsonTransformation] + public partial class Image : Resource + { + /// + /// Initializes a new instance of the Image class. + /// + public Image() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Image class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The source virtual machine from + /// which Image is created. + /// Specifies the storage settings for the + /// virtual machine disks. + /// The provisioning state. + /// Specifies the HyperVGenerationType + /// of the VirtualMachine created from the image. From API Version + /// 2019-03-01 if the image source is a blob, then we need the user to + /// specify the value, if the source is managed resource like disk or + /// snapshot, we may require the user to specify the property if we + /// cannot deduce it from the source managed resource. Possible values + /// include: 'V1', 'V2' + /// The extended location of the + /// Image. + public Image(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + SourceVirtualMachine = sourceVirtualMachine; + StorageProfile = storageProfile; + ProvisioningState = provisioningState; + HyperVGeneration = hyperVGeneration; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source virtual machine from which Image is + /// created. + /// + [JsonProperty(PropertyName = "properties.sourceVirtualMachine")] + public SubResource SourceVirtualMachine { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public ImageStorageProfile StorageProfile { get; set; } + + /// + /// Gets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets specifies the HyperVGenerationType of the + /// VirtualMachine created from the image. From API Version 2019-03-01 + /// if the image source is a blob, then we need the user to specify the + /// value, if the source is managed resource like disk or snapshot, we + /// may require the user to specify the property if we cannot deduce it + /// from the source managed resource. Possible values include: 'V1', + /// 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the extended location of the Image. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDataDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDataDisk.cs new file mode 100644 index 000000000000..d427719d6e52 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDataDisk.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a data disk. + /// + public partial class ImageDataDisk : ImageDisk + { + /// + /// Initializes a new instance of the ImageDataDisk class. + /// + public ImageDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDataDisk class. + /// + /// 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. + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The default + /// values are: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. This value cannot be larger than + /// 1023 GB. + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDataDisk(int lun, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDeprecationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDeprecationStatus.cs new file mode 100644 index 000000000000..208098b11215 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDeprecationStatus.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes image deprecation status properties on the image. + /// + public partial class ImageDeprecationStatus + { + /// + /// Initializes a new instance of the ImageDeprecationStatus class. + /// + public ImageDeprecationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDeprecationStatus class. + /// + /// Describes the state of the image. Possible + /// values include: 'Active', 'ScheduledForDeprecation', + /// 'Deprecated' + /// The time, in future, at + /// which this image will be marked as deprecated. This scheduled time + /// is chosen by the Publisher. + public ImageDeprecationStatus(string imageState = default(string), System.DateTime? scheduledDeprecationTime = default(System.DateTime?), AlternativeOption alternativeOption = default(AlternativeOption)) + { + ImageState = imageState; + ScheduledDeprecationTime = scheduledDeprecationTime; + AlternativeOption = alternativeOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the state of the image. Possible values + /// include: 'Active', 'ScheduledForDeprecation', 'Deprecated' + /// + [JsonProperty(PropertyName = "imageState")] + public string ImageState { get; set; } + + /// + /// Gets or sets the time, in future, at which this image will be + /// marked as deprecated. This scheduled time is chosen by the + /// Publisher. + /// + [JsonProperty(PropertyName = "scheduledDeprecationTime")] + public System.DateTime? ScheduledDeprecationTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "alternativeOption")] + public AlternativeOption AlternativeOption { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDisk.cs new file mode 100644 index 000000000000..e75a4a333176 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDisk.cs @@ -0,0 +1,121 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a image disk. + /// + public partial class ImageDisk + { + /// + /// Initializes a new instance of the ImageDisk class. + /// + public ImageDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDisk class. + /// + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The default + /// values are: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. This value cannot be larger than + /// 1023 GB. + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDisk(SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + { + Snapshot = snapshot; + ManagedDisk = managedDisk; + BlobUri = blobUri; + Caching = caching; + DiskSizeGB = diskSizeGB; + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the snapshot. + /// + [JsonProperty(PropertyName = "snapshot")] + public SubResource Snapshot { get; set; } + + /// + /// Gets or sets the managedDisk. + /// + [JsonProperty(PropertyName = "managedDisk")] + public SubResource ManagedDisk { get; set; } + + /// + /// Gets or sets the Virtual Hard Disk. + /// + [JsonProperty(PropertyName = "blobUri")] + public string BlobUri { get; set; } + + /// + /// Gets or sets specifies the caching requirements. Possible values + /// are: **None,** **ReadOnly,** **ReadWrite.** The default values are: + /// **None for Standard storage. ReadOnly for Premium storage.**. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies the size of empty data disks in gigabytes. + /// This element can be used to overwrite the name of the disk in a + /// virtual machine image. This value cannot be larger than 1023 GB. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed image disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDiskReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDiskReference.cs new file mode 100644 index 000000000000..7b02864e315a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageDiskReference.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image used for creating the disk. + /// + public partial class ImageDiskReference + { + /// + /// Initializes a new instance of the ImageDiskReference class. + /// + public ImageDiskReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDiskReference class. + /// + /// A relative uri containing either a Platform Image + /// Repository, user image, or Azure Compute Gallery image + /// reference. + /// A relative uri containing a + /// direct shared Azure Compute Gallery image reference. + /// A relative uri containing a + /// community Azure Compute Gallery image reference. + /// If the disk is created from an image's data disk, + /// this is an index that indicates which of the data disks in the + /// image to use. For OS disks, this field is null. + public ImageDiskReference(string id = default(string), string sharedGalleryImageId = default(string), string communityGalleryImageId = default(string), int? lun = default(int?)) + { + Id = id; + SharedGalleryImageId = sharedGalleryImageId; + CommunityGalleryImageId = communityGalleryImageId; + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a relative uri containing either a Platform Image + /// Repository, user image, or Azure Compute Gallery image reference. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets a relative uri containing a direct shared Azure + /// Compute Gallery image reference. + /// + [JsonProperty(PropertyName = "sharedGalleryImageId")] + public string SharedGalleryImageId { get; set; } + + /// + /// Gets or sets a relative uri containing a community Azure Compute + /// Gallery image reference. + /// + [JsonProperty(PropertyName = "communityGalleryImageId")] + public string CommunityGalleryImageId { get; set; } + + /// + /// Gets or sets if the disk is created from an image's data disk, this + /// is an index that indicates which of the data disks in the image to + /// use. For OS disks, this field is null. + /// + [JsonProperty(PropertyName = "lun")] + public int? Lun { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageOSDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageOSDisk.cs new file mode 100644 index 000000000000..37fe4872237c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageOSDisk.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Operating System disk. + /// + public partial class ImageOSDisk : ImageDisk + { + /// + /// Initializes a new instance of the ImageOSDisk class. + /// + public ImageOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageOSDisk class. + /// + /// 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.**. + /// Possible values include: 'Windows', 'Linux' + /// The OS State. For managed images, use + /// Generalized. Possible values include: 'Generalized', + /// 'Specialized' + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The default + /// values are: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. This value cannot be larger than + /// 1023 GB. + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + { + OsType = osType; + OsState = osState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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.**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets the OS State. For managed images, use Generalized. + /// Possible values include: 'Generalized', 'Specialized' + /// + [JsonProperty(PropertyName = "osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImagePurchasePlan.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImagePurchasePlan.cs new file mode 100644 index 000000000000..491af12db0e4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImagePurchasePlan.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the gallery image definition purchase plan. This is used by + /// marketplace images. + /// + public partial class ImagePurchasePlan + { + /// + /// Initializes a new instance of the ImagePurchasePlan class. + /// + public ImagePurchasePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImagePurchasePlan class. + /// + /// The plan ID. + /// The publisher ID. + /// The product ID. + public ImagePurchasePlan(string name = default(string), string publisher = default(string), string product = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the product ID. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageReference.cs new file mode 100644 index 000000000000..e1093f302a46 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageReference.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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. + /// + public partial class ImageReference : SubResource + { + /// + /// Initializes a new instance of the ImageReference class. + /// + public ImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageReference class. + /// + /// Resource Id + /// The image publisher. + /// Specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// The image SKU. + /// Specifies the version of the platform image + /// or marketplace image used to create the virtual machine. The + /// allowed formats are Major.Minor.Build or 'latest'. Major, Minor, + /// and Build are decimal numbers. Specify 'latest' to use the latest + /// version of an image available at deploy time. Even if you use + /// 'latest', the VM image will not automatically update after deploy + /// time even if a new version becomes available. Please do not use + /// field 'version' for gallery image deployment, gallery image should + /// always use 'id' field for deployment, to use 'latest' version of + /// gallery image, just set + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + /// in the 'id' field without version input. + /// Specifies in decimal numbers, the + /// version of platform image or marketplace image used to create the + /// virtual machine. This readonly field differs from 'version', only + /// if the value specified in 'version' field is 'latest'. + /// Specified the shared gallery + /// image unique id for vm deployment. This can be fetched from shared + /// gallery image GET call. + /// Specified the community + /// gallery image unique id for vm deployment. This can be fetched from + /// community gallery image GET call. + public ImageReference(string id = default(string), string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string), string exactVersion = default(string), string sharedGalleryImageId = default(string), string communityGalleryImageId = default(string)) + : base(id) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + Version = version; + ExactVersion = exactVersion; + SharedGalleryImageId = sharedGalleryImageId; + CommunityGalleryImageId = communityGalleryImageId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the image SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets specifies the version of the platform image or + /// marketplace image used to create the virtual machine. The allowed + /// formats are Major.Minor.Build or 'latest'. Major, Minor, and Build + /// are decimal numbers. Specify 'latest' to use the latest version of + /// an image available at deploy time. Even if you use 'latest', the VM + /// image will not automatically update after deploy time even if a new + /// version becomes available. Please do not use field 'version' for + /// gallery image deployment, gallery image should always use 'id' + /// field for deployment, to use 'latest' version of gallery image, + /// just set + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + /// in the 'id' field without version input. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets specifies in decimal numbers, the version of platform image or + /// marketplace image used to create the virtual machine. This readonly + /// field differs from 'version', only if the value specified in + /// 'version' field is 'latest'. + /// + [JsonProperty(PropertyName = "exactVersion")] + public string ExactVersion { get; private set; } + + /// + /// Gets or sets specified the shared gallery image unique id for vm + /// deployment. This can be fetched from shared gallery image GET call. + /// + [JsonProperty(PropertyName = "sharedGalleryImageId")] + public string SharedGalleryImageId { get; set; } + + /// + /// Gets or sets specified the community gallery image unique id for vm + /// deployment. This can be fetched from community gallery image GET + /// call. + /// + [JsonProperty(PropertyName = "communityGalleryImageId")] + public string CommunityGalleryImageId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageState.cs new file mode 100644 index 000000000000..7b86d3b4d8a7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ImageState. + /// + public static class ImageState + { + public const string Active = "Active"; + public const string ScheduledForDeprecation = "ScheduledForDeprecation"; + public const string Deprecated = "Deprecated"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageStorageProfile.cs new file mode 100644 index 000000000000..262482c56523 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageStorageProfile.cs @@ -0,0 +1,113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a storage profile. + /// + public partial class ImageStorageProfile + { + /// + /// Initializes a new instance of the ImageStorageProfile class. + /// + public ImageStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageStorageProfile class. + /// + /// Specifies information about the operating + /// system disk used by the virtual machine. <br><br> For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// Specifies the parameters that are used to + /// add a data disk to a virtual machine. <br><br> For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// Specifies whether an image is zone + /// resilient or not. Default is false. Zone resilient images can be + /// created only in regions that provide Zone Redundant Storage + /// (ZRS). + public ImageStorageProfile(ImageOSDisk osDisk = default(ImageOSDisk), IList dataDisks = default(IList), bool? zoneResilient = default(bool?)) + { + OsDisk = osDisk; + DataDisks = dataDisks; + ZoneResilient = zoneResilient; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machine. &lt;br&gt;&lt;br&gt; + /// For more information about disks, see [About disks and VHDs for + /// Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "osDisk")] + public ImageOSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add a data + /// disk to a virtual machine. &lt;br&gt;&lt;br&gt; For + /// more information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Gets or sets specifies whether an image is zone resilient or not. + /// Default is false. Zone resilient images can be created only in + /// regions that provide Zone Redundant Storage (ZRS). + /// + [JsonProperty(PropertyName = "zoneResilient")] + public bool? ZoneResilient { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ImageUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageUpdate.cs new file mode 100644 index 000000000000..8d9a073172fc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ImageUpdate.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The source user image virtual hard disk. Only tags may be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class ImageUpdate : UpdateResource + { + /// + /// Initializes a new instance of the ImageUpdate class. + /// + public ImageUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageUpdate class. + /// + /// Resource tags + /// The source virtual machine from + /// which Image is created. + /// Specifies the storage settings for the + /// virtual machine disks. + /// The provisioning state. + /// Specifies the HyperVGenerationType + /// of the VirtualMachine created from the image. From API Version + /// 2019-03-01 if the image source is a blob, then we need the user to + /// specify the value, if the source is managed resource like disk or + /// snapshot, we may require the user to specify the property if we + /// cannot deduce it from the source managed resource. Possible values + /// include: 'V1', 'V2' + public ImageUpdate(IDictionary tags = default(IDictionary), SubResource sourceVirtualMachine = default(SubResource), ImageStorageProfile storageProfile = default(ImageStorageProfile), string provisioningState = default(string), string hyperVGeneration = default(string)) + : base(tags) + { + SourceVirtualMachine = sourceVirtualMachine; + StorageProfile = storageProfile; + ProvisioningState = provisioningState; + HyperVGeneration = hyperVGeneration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source virtual machine from which Image is + /// created. + /// + [JsonProperty(PropertyName = "properties.sourceVirtualMachine")] + public SubResource SourceVirtualMachine { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public ImageStorageProfile StorageProfile { get; set; } + + /// + /// Gets the provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets specifies the HyperVGenerationType of the + /// VirtualMachine created from the image. From API Version 2019-03-01 + /// if the image source is a blob, then we need the user to specify the + /// value, if the source is managed resource like disk or snapshot, we + /// may require the user to specify the property if we cannot deduce it + /// from the source managed resource. Possible values include: 'V1', + /// 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/InnerError.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/InnerError.cs new file mode 100644 index 000000000000..781614b2e68e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/InnerError.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Inner error details. + /// + public partial class InnerError + { + /// + /// Initializes a new instance of the InnerError class. + /// + public InnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerError class. + /// + /// The exception type. + /// The internal error message or exception + /// dump. + public InnerError(string exceptiontype = default(string), string errordetail = default(string)) + { + Exceptiontype = exceptiontype; + Errordetail = errordetail; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the exception type. + /// + [JsonProperty(PropertyName = "exceptiontype")] + public string Exceptiontype { get; set; } + + /// + /// Gets or sets the internal error message or exception dump. + /// + [JsonProperty(PropertyName = "errordetail")] + public string Errordetail { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceSku.cs new file mode 100644 index 000000000000..2ca696b88b11 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceSku.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The role instance SKU. + /// + public partial class InstanceSku + { + /// + /// Initializes a new instance of the InstanceSku class. + /// + public InstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceSku class. + /// + /// The sku name. + /// The tier of the cloud service role + /// instance. + public InstanceSku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the sku name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the tier of the cloud service role instance. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatus.cs new file mode 100644 index 000000000000..ce05542f9f87 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatus.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Instance view status. + /// + public partial class InstanceViewStatus + { + /// + /// Initializes a new instance of the InstanceViewStatus class. + /// + public InstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceViewStatus class. + /// + /// The status code. + /// The level code. Possible values include: + /// 'Info', 'Warning', 'Error' + /// The short localizable label for the + /// status. + /// The detailed status message, including for + /// alerts and error messages. + /// The time of the status. + public InstanceViewStatus(string code = default(string), StatusLevelTypes? level = default(StatusLevelTypes?), string displayStatus = default(string), string message = default(string), System.DateTime? time = default(System.DateTime?)) + { + Code = code; + Level = level; + DisplayStatus = displayStatus; + Message = message; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the level code. Possible values include: 'Info', + /// 'Warning', 'Error' + /// + [JsonProperty(PropertyName = "level")] + public StatusLevelTypes? Level { get; set; } + + /// + /// Gets or sets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; set; } + + /// + /// Gets or sets the detailed status message, including for alerts and + /// error messages. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the time of the status. + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatusesSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatusesSummary.cs new file mode 100644 index 000000000000..f8439a52e1f8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewStatusesSummary.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Instance view statuses. + /// + public partial class InstanceViewStatusesSummary + { + /// + /// Initializes a new instance of the InstanceViewStatusesSummary + /// class. + /// + public InstanceViewStatusesSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstanceViewStatusesSummary + /// class. + /// + /// The summary. + public InstanceViewStatusesSummary(IList statusesSummary = default(IList)) + { + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the summary. + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewTypes.cs new file mode 100644 index 000000000000..0b476450d573 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/InstanceViewTypes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for InstanceViewTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum InstanceViewTypes + { + [EnumMember(Value = "instanceView")] + InstanceView, + [EnumMember(Value = "userData")] + UserData + } + internal static class InstanceViewTypesEnumExtension + { + internal static string ToSerializedValue(this InstanceViewTypes? value) + { + return value == null ? null : ((InstanceViewTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this InstanceViewTypes value) + { + switch( value ) + { + case InstanceViewTypes.InstanceView: + return "instanceView"; + case InstanceViewTypes.UserData: + return "userData"; + } + return null; + } + + internal static InstanceViewTypes? ParseInstanceViewTypes(this string value) + { + switch( value ) + { + case "instanceView": + return InstanceViewTypes.InstanceView; + case "userData": + return InstanceViewTypes.UserData; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/IntervalInMins.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/IntervalInMins.cs new file mode 100644 index 000000000000..3438b2d9c359 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/IntervalInMins.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IntervalInMins. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IntervalInMins + { + [EnumMember(Value = "ThreeMins")] + ThreeMins, + [EnumMember(Value = "FiveMins")] + FiveMins, + [EnumMember(Value = "ThirtyMins")] + ThirtyMins, + [EnumMember(Value = "SixtyMins")] + SixtyMins + } + internal static class IntervalInMinsEnumExtension + { + internal static string ToSerializedValue(this IntervalInMins? value) + { + return value == null ? null : ((IntervalInMins)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IntervalInMins value) + { + switch( value ) + { + case IntervalInMins.ThreeMins: + return "ThreeMins"; + case IntervalInMins.FiveMins: + return "FiveMins"; + case IntervalInMins.ThirtyMins: + return "ThirtyMins"; + case IntervalInMins.SixtyMins: + return "SixtyMins"; + } + return null; + } + + internal static IntervalInMins? ParseIntervalInMins(this string value) + { + switch( value ) + { + case "ThreeMins": + return IntervalInMins.ThreeMins; + case "FiveMins": + return IntervalInMins.FiveMins; + case "ThirtyMins": + return IntervalInMins.ThirtyMins; + case "SixtyMins": + return IntervalInMins.SixtyMins; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/KeyForDiskEncryptionSet.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyForDiskEncryptionSet.cs new file mode 100644 index 000000000000..c4c109920076 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyForDiskEncryptionSet.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Key Vault Key Url to be used for server side encryption of Managed + /// Disks and Snapshots + /// + public partial class KeyForDiskEncryptionSet + { + /// + /// Initializes a new instance of the KeyForDiskEncryptionSet class. + /// + public KeyForDiskEncryptionSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyForDiskEncryptionSet class. + /// + /// Fully versioned Key Url pointing to a key in + /// KeyVault. Version segment of the Url is required regardless of + /// rotationToLatestKeyVersionEnabled value. + /// Resource id of the KeyVault containing + /// the key or secret. This property is optional and cannot be used if + /// the KeyVault subscription is not the same as the Disk Encryption + /// Set subscription. + public KeyForDiskEncryptionSet(string keyUrl, SourceVault sourceVault = default(SourceVault)) + { + SourceVault = sourceVault; + KeyUrl = keyUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the KeyVault containing the key or + /// secret. This property is optional and cannot be used if the + /// KeyVault subscription is not the same as the Disk Encryption Set + /// subscription. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SourceVault SourceVault { get; set; } + + /// + /// Gets or sets fully versioned Key Url pointing to a key in KeyVault. + /// Version segment of the Url is required regardless of + /// rotationToLatestKeyVersionEnabled value. + /// + [JsonProperty(PropertyName = "keyUrl")] + public string KeyUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyUrl"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndKeyReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndKeyReference.cs new file mode 100644 index 000000000000..c1ad35762179 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndKeyReference.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Key Vault Key Url and vault id of KeK, KeK is optional and when + /// provided is used to unwrap the encryptionKey + /// + public partial class KeyVaultAndKeyReference + { + /// + /// Initializes a new instance of the KeyVaultAndKeyReference class. + /// + public KeyVaultAndKeyReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultAndKeyReference class. + /// + /// Resource id of the KeyVault containing + /// the key or secret + /// Url pointing to a key or secret in + /// KeyVault + public KeyVaultAndKeyReference(SourceVault sourceVault, string keyUrl) + { + SourceVault = sourceVault; + KeyUrl = keyUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the KeyVault containing the key or + /// secret + /// + [JsonProperty(PropertyName = "sourceVault")] + public SourceVault SourceVault { get; set; } + + /// + /// Gets or sets url pointing to a key or secret in KeyVault + /// + [JsonProperty(PropertyName = "keyUrl")] + public string KeyUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + if (KeyUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyUrl"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndSecretReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndSecretReference.cs new file mode 100644 index 000000000000..e19c6a5c8cc6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultAndSecretReference.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Key Vault Secret Url and vault id of the encryption key + /// + public partial class KeyVaultAndSecretReference + { + /// + /// Initializes a new instance of the KeyVaultAndSecretReference class. + /// + public KeyVaultAndSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultAndSecretReference class. + /// + /// Resource id of the KeyVault containing + /// the key or secret + /// Url pointing to a key or secret in + /// KeyVault + public KeyVaultAndSecretReference(SourceVault sourceVault, string secretUrl) + { + SourceVault = sourceVault; + SecretUrl = secretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the KeyVault containing the key or + /// secret + /// + [JsonProperty(PropertyName = "sourceVault")] + public SourceVault SourceVault { get; set; } + + /// + /// Gets or sets url pointing to a key or secret in KeyVault + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + if (SecretUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretUrl"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultKeyReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultKeyReference.cs new file mode 100644 index 000000000000..3965245b5f31 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultKeyReference.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a reference to Key Vault Key + /// + public partial class KeyVaultKeyReference + { + /// + /// Initializes a new instance of the KeyVaultKeyReference class. + /// + public KeyVaultKeyReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultKeyReference class. + /// + /// The URL referencing a key encryption key in + /// Key Vault. + /// The relative URL of the Key Vault + /// containing the key. + public KeyVaultKeyReference(string keyUrl, SubResource sourceVault) + { + KeyUrl = keyUrl; + SourceVault = sourceVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL referencing a key encryption key in Key Vault. + /// + [JsonProperty(PropertyName = "keyUrl")] + public string KeyUrl { get; set; } + + /// + /// Gets or sets the relative URL of the Key Vault containing the key. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyUrl"); + } + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultSecretReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultSecretReference.cs new file mode 100644 index 000000000000..cf99d6b4c143 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/KeyVaultSecretReference.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a reference to Key Vault Secret + /// + public partial class KeyVaultSecretReference + { + /// + /// Initializes a new instance of the KeyVaultSecretReference class. + /// + public KeyVaultSecretReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultSecretReference class. + /// + /// The URL referencing a secret in a Key + /// Vault. + /// The relative URL of the Key Vault + /// containing the secret. + public KeyVaultSecretReference(string secretUrl, SubResource sourceVault) + { + SecretUrl = secretUrl; + SourceVault = sourceVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL referencing a secret in a Key Vault. + /// + [JsonProperty(PropertyName = "secretUrl")] + public string SecretUrl { get; set; } + + /// + /// Gets or sets the relative URL of the Key Vault containing the + /// secret. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SecretUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretUrl"); + } + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LastPatchInstallationSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LastPatchInstallationSummary.cs new file mode 100644 index 000000000000..3afaee59807a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LastPatchInstallationSummary.cs @@ -0,0 +1,165 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of the last installed patch summary. + /// + public partial class LastPatchInstallationSummary + { + /// + /// Initializes a new instance of the LastPatchInstallationSummary + /// class. + /// + public LastPatchInstallationSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LastPatchInstallationSummary + /// class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the + /// operation that produced this result. It is used to correlate across + /// CRP and extension logs. + /// Describes whether the + /// operation ran out of time before it completed all its intended + /// actions + /// The number of all available + /// patches but not going to be installed because it didn't match a + /// classification or inclusion list entry. + /// The number of all available + /// patches but excluded explicitly by a customer-specified exclusion + /// list match. + /// The number of all available patches + /// expected to be installed over the course of the patch installation + /// operation. + /// The count of patches that + /// successfully installed. + /// The count of patches that failed + /// installation. + /// The UTC timestamp when the operation + /// began. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public LastPatchInstallationSummary(string status = default(string), string installationActivityId = default(string), bool? maintenanceWindowExceeded = default(bool?), int? notSelectedPatchCount = default(int?), int? excludedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + InstallationActivityId = installationActivityId; + MaintenanceWindowExceeded = maintenanceWindowExceeded; + NotSelectedPatchCount = notSelectedPatchCount; + ExcludedPatchCount = excludedPatchCount; + PendingPatchCount = pendingPatchCount; + InstalledPatchCount = installedPatchCount; + FailedPatchCount = failedPatchCount; + StartTime = startTime; + LastModifiedTime = lastModifiedTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "installationActivityId")] + public string InstallationActivityId { get; private set; } + + /// + /// Gets describes whether the operation ran out of time before it + /// completed all its intended actions + /// + [JsonProperty(PropertyName = "maintenanceWindowExceeded")] + public bool? MaintenanceWindowExceeded { get; private set; } + + /// + /// Gets the number of all available patches but not going to be + /// installed because it didn't match a classification or inclusion + /// list entry. + /// + [JsonProperty(PropertyName = "notSelectedPatchCount")] + public int? NotSelectedPatchCount { get; private set; } + + /// + /// Gets the number of all available patches but excluded explicitly by + /// a customer-specified exclusion list match. + /// + [JsonProperty(PropertyName = "excludedPatchCount")] + public int? ExcludedPatchCount { get; private set; } + + /// + /// Gets the number of all available patches expected to be installed + /// over the course of the patch installation operation. + /// + [JsonProperty(PropertyName = "pendingPatchCount")] + public int? PendingPatchCount { get; private set; } + + /// + /// Gets the count of patches that successfully installed. + /// + [JsonProperty(PropertyName = "installedPatchCount")] + public int? InstalledPatchCount { get; private set; } + + /// + /// Gets the count of patches that failed installation. + /// + [JsonProperty(PropertyName = "failedPatchCount")] + public int? FailedPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LatestGalleryImageVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LatestGalleryImageVersion.cs new file mode 100644 index 000000000000..a9d7710f2466 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LatestGalleryImageVersion.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The gallery image version with latest version in a particular region. + /// + public partial class LatestGalleryImageVersion + { + /// + /// Initializes a new instance of the LatestGalleryImageVersion class. + /// + public LatestGalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LatestGalleryImageVersion class. + /// + /// The name of the latest version in + /// the region. + /// region of the Gallery Image Version. + public LatestGalleryImageVersion(string latestVersionName = default(string), string location = default(string)) + { + LatestVersionName = latestVersionName; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the latest version in the region. + /// + [JsonProperty(PropertyName = "latestVersionName")] + public string LatestVersionName { get; set; } + + /// + /// Gets or sets region of the Gallery Image Version. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxConfiguration.cs new file mode 100644 index 000000000000..81b3a3832357 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxConfiguration.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the Linux operating system settings on the virtual machine. + /// For a list of supported Linux distributions, see [Linux on + /// Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// + public partial class LinuxConfiguration + { + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + public LinuxConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + /// Specifies whether + /// password authentication should be disabled. + /// Specifies the ssh key configuration for a Linux + /// OS. + /// Indicates whether virtual machine + /// agent should be provisioned on the virtual machine. When this + /// property is not specified in the request body, default behavior is + /// to set it to true. This will ensure that VM Agent is installed on + /// the VM so that extensions can be added to the VM later. + /// [Preview Feature] Specifies settings + /// related to VM Guest Patching on Linux. + /// Indicates whether + /// VMAgent Platform Updates is enabled for the Linux virtual machine. + /// Default value is false. + public LinuxConfiguration(bool? disablePasswordAuthentication = default(bool?), SshConfiguration ssh = default(SshConfiguration), bool? provisionVMAgent = default(bool?), LinuxPatchSettings patchSettings = default(LinuxPatchSettings), bool? enableVMAgentPlatformUpdates = default(bool?)) + { + DisablePasswordAuthentication = disablePasswordAuthentication; + Ssh = ssh; + ProvisionVMAgent = provisionVMAgent; + PatchSettings = patchSettings; + EnableVMAgentPlatformUpdates = enableVMAgentPlatformUpdates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether password authentication should be + /// disabled. + /// + [JsonProperty(PropertyName = "disablePasswordAuthentication")] + public bool? DisablePasswordAuthentication { get; set; } + + /// + /// Gets or sets specifies the ssh key configuration for a Linux OS. + /// + [JsonProperty(PropertyName = "ssh")] + public SshConfiguration Ssh { get; set; } + + /// + /// Gets or sets indicates whether virtual machine agent should be + /// provisioned on the virtual machine. When this property is not + /// specified in the request body, default behavior is to set it to + /// true. This will ensure that VM Agent is installed on the VM so that + /// extensions can be added to the VM later. + /// + [JsonProperty(PropertyName = "provisionVMAgent")] + public bool? ProvisionVMAgent { get; set; } + + /// + /// Gets or sets [Preview Feature] Specifies settings related to VM + /// Guest Patching on Linux. + /// + [JsonProperty(PropertyName = "patchSettings")] + public LinuxPatchSettings PatchSettings { get; set; } + + /// + /// Gets or sets indicates whether VMAgent Platform Updates is enabled + /// for the Linux virtual machine. Default value is false. + /// + [JsonProperty(PropertyName = "enableVMAgentPlatformUpdates")] + public bool? EnableVMAgentPlatformUpdates { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxParameters.cs new file mode 100644 index 000000000000..4deea634136d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxParameters.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Input for InstallPatches on a Linux VM, as directly received by the API + /// + public partial class LinuxParameters + { + /// + /// Initializes a new instance of the LinuxParameters class. + /// + public LinuxParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxParameters class. + /// + /// The update classifications + /// to select when installing patches for Linux. + /// packages to include in the + /// patch operation. Format: packageName_packageVersion + /// packages to exclude in the + /// patch operation. Format: packageName_packageVersion + /// This is used as a maintenance run + /// identifier for Auto VM Guest Patching in Linux. + public LinuxParameters(IList classificationsToInclude = default(IList), IList packageNameMasksToInclude = default(IList), IList packageNameMasksToExclude = default(IList), string maintenanceRunId = default(string)) + { + ClassificationsToInclude = classificationsToInclude; + PackageNameMasksToInclude = packageNameMasksToInclude; + PackageNameMasksToExclude = packageNameMasksToExclude; + MaintenanceRunId = maintenanceRunId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Linux. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets packages to include in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToInclude")] + public IList PackageNameMasksToInclude { get; set; } + + /// + /// Gets or sets packages to exclude in the patch operation. Format: + /// packageName_packageVersion + /// + [JsonProperty(PropertyName = "packageNameMasksToExclude")] + public IList PackageNameMasksToExclude { get; set; } + + /// + /// Gets or sets this is used as a maintenance run identifier for Auto + /// VM Guest Patching in Linux. + /// + [JsonProperty(PropertyName = "maintenanceRunId")] + public string MaintenanceRunId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchAssessmentMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchAssessmentMode.cs new file mode 100644 index 000000000000..51023b6e3dc4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchAssessmentMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for LinuxPatchAssessmentMode. + /// + public static class LinuxPatchAssessmentMode + { + public const string ImageDefault = "ImageDefault"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchSettings.cs new file mode 100644 index 000000000000..91a478c786a1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxPatchSettings.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies settings related to VM Guest Patching on Linux. + /// + public partial class LinuxPatchSettings + { + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + public LinuxPatchSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxPatchSettings class. + /// + /// Specifies the mode of VM Guest Patching to + /// IaaS virtual machine or virtual machines associated to virtual + /// machine scale set with OrchestrationMode as Flexible.<br + /// /><br /> Possible values are:<br /><br /> + /// **ImageDefault** - The virtual machine's default patching + /// configuration is used. <br /><br /> + /// **AutomaticByPlatform** - The virtual machine will be automatically + /// updated by the platform. The property provisionVMAgent must be + /// true. Possible values include: 'ImageDefault', + /// 'AutomaticByPlatform' + /// Specifies the mode of VM Guest Patch + /// Assessment for the IaaS virtual machine.<br /><br /> + /// Possible values are:<br /><br /> **ImageDefault** - You + /// control the timing of patch assessments on a virtual machine. + /// <br /><br /> **AutomaticByPlatform** - The platform + /// will trigger periodic patch assessments. The property + /// provisionVMAgent must be true. Possible values include: + /// 'ImageDefault', 'AutomaticByPlatform' + /// Specifies additional + /// settings for patch mode AutomaticByPlatform in VM Guest Patching on + /// Linux. + public LinuxPatchSettings(string patchMode = default(string), string assessmentMode = default(string), LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings = default(LinuxVMGuestPatchAutomaticByPlatformSettings)) + { + PatchMode = patchMode; + AssessmentMode = assessmentMode; + AutomaticByPlatformSettings = automaticByPlatformSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of VM Guest Patching to IaaS + /// virtual machine or virtual machines associated to virtual machine + /// scale set with OrchestrationMode as Flexible.&lt;br + /// /&gt;&lt;br /&gt; Possible values are:&lt;br + /// /&gt;&lt;br /&gt; **ImageDefault** - The virtual + /// machine's default patching configuration is used. &lt;br + /// /&gt;&lt;br /&gt; **AutomaticByPlatform** - The virtual + /// machine will be automatically updated by the platform. The property + /// provisionVMAgent must be true. Possible values include: + /// 'ImageDefault', 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "patchMode")] + public string PatchMode { get; set; } + + /// + /// Gets or sets specifies the mode of VM Guest Patch Assessment for + /// the IaaS virtual machine.&lt;br /&gt;&lt;br /&gt; + /// Possible values are:&lt;br /&gt;&lt;br /&gt; + /// **ImageDefault** - You control the timing of patch assessments on a + /// virtual machine. &lt;br /&gt;&lt;br /&gt; + /// **AutomaticByPlatform** - The platform will trigger periodic patch + /// assessments. The property provisionVMAgent must be true. Possible + /// values include: 'ImageDefault', 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "assessmentMode")] + public string AssessmentMode { get; set; } + + /// + /// Gets or sets specifies additional settings for patch mode + /// AutomaticByPlatform in VM Guest Patching on Linux. + /// + [JsonProperty(PropertyName = "automaticByPlatformSettings")] + public LinuxVMGuestPatchAutomaticByPlatformSettings AutomaticByPlatformSettings { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.cs new file mode 100644 index 000000000000..3de6df292b10 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + /// + public static class LinuxVMGuestPatchAutomaticByPlatformRebootSetting + { + public const string Unknown = "Unknown"; + public const string IfRequired = "IfRequired"; + public const string Never = "Never"; + public const string Always = "Always"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformSettings.cs new file mode 100644 index 000000000000..f0fd85dd1e24 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchAutomaticByPlatformSettings.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies additional settings to be applied when patch mode + /// AutomaticByPlatform is selected in Linux patch settings. + /// + public partial class LinuxVMGuestPatchAutomaticByPlatformSettings + { + /// + /// Initializes a new instance of the + /// LinuxVMGuestPatchAutomaticByPlatformSettings class. + /// + public LinuxVMGuestPatchAutomaticByPlatformSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LinuxVMGuestPatchAutomaticByPlatformSettings class. + /// + /// Specifies the reboot setting for all + /// AutomaticByPlatform patch installation operations. Possible values + /// include: 'Unknown', 'IfRequired', 'Never', 'Always' + /// Enables + /// customer to schedule patching without accidental upgrades + public LinuxVMGuestPatchAutomaticByPlatformSettings(string rebootSetting = default(string), bool? bypassPlatformSafetyChecksOnUserSchedule = default(bool?)) + { + RebootSetting = rebootSetting; + BypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the reboot setting for all + /// AutomaticByPlatform patch installation operations. Possible values + /// include: 'Unknown', 'IfRequired', 'Never', 'Always' + /// + [JsonProperty(PropertyName = "rebootSetting")] + public string RebootSetting { get; set; } + + /// + /// Gets or sets enables customer to schedule patching without + /// accidental upgrades + /// + [JsonProperty(PropertyName = "bypassPlatformSafetyChecksOnUserSchedule")] + public bool? BypassPlatformSafetyChecksOnUserSchedule { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchMode.cs new file mode 100644 index 000000000000..403817291610 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LinuxVMGuestPatchMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for LinuxVMGuestPatchMode. + /// + public static class LinuxVMGuestPatchMode + { + public const string ImageDefault = "ImageDefault"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfiguration.cs new file mode 100644 index 000000000000..f9f18299ba25 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfiguration.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the load balancer configuration. + /// + public partial class LoadBalancerConfiguration + { + /// + /// Initializes a new instance of the LoadBalancerConfiguration class. + /// + public LoadBalancerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancerConfiguration class. + /// + /// The name of the Load balancer + /// Properties of the load balancer + /// configuration. + /// Resource Id + public LoadBalancerConfiguration(string name, LoadBalancerConfigurationProperties properties, string id = default(string)) + { + Id = id; + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the name of the Load balancer + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets properties of the load balancer configuration. + /// + [JsonProperty(PropertyName = "properties")] + public LoadBalancerConfigurationProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfigurationProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfigurationProperties.cs new file mode 100644 index 000000000000..5a9d1d82dc75 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerConfigurationProperties.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the properties of the load balancer configuration. + /// + public partial class LoadBalancerConfigurationProperties + { + /// + /// Initializes a new instance of the + /// LoadBalancerConfigurationProperties class. + /// + public LoadBalancerConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerConfigurationProperties class. + /// + /// Specifies the frontend IP to + /// be used for the load balancer. Only IPv4 frontend IP address is + /// supported. Each load balancer configuration must have exactly one + /// frontend IP configuration. + public LoadBalancerConfigurationProperties(IList frontendIpConfigurations) + { + FrontendIpConfigurations = frontendIpConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the frontend IP to be used for the load + /// balancer. Only IPv4 frontend IP address is supported. Each load + /// balancer configuration must have exactly one frontend IP + /// configuration. + /// + [JsonProperty(PropertyName = "frontendIpConfigurations")] + public IList FrontendIpConfigurations { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FrontendIpConfigurations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FrontendIpConfigurations"); + } + if (FrontendIpConfigurations != null) + { + foreach (var element in FrontendIpConfigurations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfiguration.cs new file mode 100644 index 000000000000..cd30bf587957 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfiguration.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the frontend IP to be used for the load balancer. Only IPv4 + /// frontend IP address is supported. Each load balancer configuration must + /// have exactly one frontend IP configuration. + /// + public partial class LoadBalancerFrontendIpConfiguration + { + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIpConfiguration class. + /// + public LoadBalancerFrontendIpConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIpConfiguration class. + /// + /// The name of the resource that is unique within + /// the set of frontend IP configurations used by the load balancer. + /// This name can be used to access the resource. + /// Properties of load balancer frontend ip + /// configuration. + public LoadBalancerFrontendIpConfiguration(string name, LoadBalancerFrontendIpConfigurationProperties properties) + { + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource that is unique within the set + /// of frontend IP configurations used by the load balancer. This name + /// can be used to access the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets properties of load balancer frontend ip configuration. + /// + [JsonProperty(PropertyName = "properties")] + public LoadBalancerFrontendIpConfigurationProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfigurationProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfigurationProperties.cs new file mode 100644 index 000000000000..4c88b4f01815 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LoadBalancerFrontendIpConfigurationProperties.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service IP Configuration + /// + public partial class LoadBalancerFrontendIpConfigurationProperties + { + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIpConfigurationProperties class. + /// + public LoadBalancerFrontendIpConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LoadBalancerFrontendIpConfigurationProperties class. + /// + /// The reference to the public ip + /// address resource. + /// The reference to the virtual network subnet + /// resource. + /// The virtual network private IP + /// address of the IP configuration. + public LoadBalancerFrontendIpConfigurationProperties(SubResource publicIPAddress = default(SubResource), SubResource subnet = default(SubResource), string privateIPAddress = default(string)) + { + PublicIPAddress = publicIPAddress; + Subnet = subnet; + PrivateIPAddress = privateIPAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the reference to the public ip address resource. + /// + [JsonProperty(PropertyName = "publicIPAddress")] + public SubResource PublicIPAddress { get; set; } + + /// + /// Gets or sets the reference to the virtual network subnet resource. + /// + [JsonProperty(PropertyName = "subnet")] + public SubResource Subnet { get; set; } + + /// + /// Gets or sets the virtual network private IP address of the IP + /// configuration. + /// + [JsonProperty(PropertyName = "privateIPAddress")] + public string PrivateIPAddress { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsInputBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsInputBase.cs new file mode 100644 index 000000000000..925a407294df --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsInputBase.cs @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Api input base class for LogAnalytics Api. + /// + public partial class LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the LogAnalyticsInputBase class. + /// + public LogAnalyticsInputBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsInputBase class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// Name. + /// Group query result by Resource + /// Name. + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public LogAnalyticsInputBase(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) + { + BlobContainerSasUri = blobContainerSasUri; + FromTime = fromTime; + ToTime = toTime; + GroupByThrottlePolicy = groupByThrottlePolicy; + GroupByOperationName = groupByOperationName; + GroupByResourceName = groupByResourceName; + GroupByClientApplicationId = groupByClientApplicationId; + GroupByUserAgent = groupByUserAgent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SAS Uri of the logging blob container to which + /// LogAnalytics Api writes output logs to. + /// + [JsonProperty(PropertyName = "blobContainerSasUri")] + public string BlobContainerSasUri { get; set; } + + /// + /// Gets or sets from time of the query + /// + [JsonProperty(PropertyName = "fromTime")] + public System.DateTime FromTime { get; set; } + + /// + /// Gets or sets to time of the query + /// + [JsonProperty(PropertyName = "toTime")] + public System.DateTime ToTime { get; set; } + + /// + /// Gets or sets group query result by Throttle Policy applied. + /// + [JsonProperty(PropertyName = "groupByThrottlePolicy")] + public bool? GroupByThrottlePolicy { get; set; } + + /// + /// Gets or sets group query result by Operation Name. + /// + [JsonProperty(PropertyName = "groupByOperationName")] + public bool? GroupByOperationName { get; set; } + + /// + /// Gets or sets group query result by Resource Name. + /// + [JsonProperty(PropertyName = "groupByResourceName")] + public bool? GroupByResourceName { get; set; } + + /// + /// Gets or sets group query result by Client Application ID. + /// + [JsonProperty(PropertyName = "groupByClientApplicationId")] + public bool? GroupByClientApplicationId { get; set; } + + /// + /// Gets or sets group query result by User Agent. + /// + [JsonProperty(PropertyName = "groupByUserAgent")] + public bool? GroupByUserAgent { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BlobContainerSasUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BlobContainerSasUri"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOperationResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOperationResult.cs new file mode 100644 index 000000000000..f2a5fdcb17e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOperationResult.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// LogAnalytics operation status response + /// + public partial class LogAnalyticsOperationResult + { + /// + /// Initializes a new instance of the LogAnalyticsOperationResult + /// class. + /// + public LogAnalyticsOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsOperationResult + /// class. + /// + /// LogAnalyticsOutput + public LogAnalyticsOperationResult(LogAnalyticsOutput properties = default(LogAnalyticsOutput)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets logAnalyticsOutput + /// + [JsonProperty(PropertyName = "properties")] + public LogAnalyticsOutput Properties { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOutput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOutput.cs new file mode 100644 index 000000000000..97b5920a51ff --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/LogAnalyticsOutput.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// LogAnalytics output properties + /// + public partial class LogAnalyticsOutput + { + /// + /// Initializes a new instance of the LogAnalyticsOutput class. + /// + public LogAnalyticsOutput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsOutput class. + /// + /// Output file Uri path to blob + /// container. + public LogAnalyticsOutput(string output = default(string)) + { + Output = output; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets output file Uri path to blob container. + /// + [JsonProperty(PropertyName = "output")] + public string Output { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceOperationResultCodeTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceOperationResultCodeTypes.cs new file mode 100644 index 000000000000..fee29be59b26 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceOperationResultCodeTypes.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MaintenanceOperationResultCodeTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MaintenanceOperationResultCodeTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "RetryLater")] + RetryLater, + [EnumMember(Value = "MaintenanceAborted")] + MaintenanceAborted, + [EnumMember(Value = "MaintenanceCompleted")] + MaintenanceCompleted + } + internal static class MaintenanceOperationResultCodeTypesEnumExtension + { + internal static string ToSerializedValue(this MaintenanceOperationResultCodeTypes? value) + { + return value == null ? null : ((MaintenanceOperationResultCodeTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MaintenanceOperationResultCodeTypes value) + { + switch( value ) + { + case MaintenanceOperationResultCodeTypes.None: + return "None"; + case MaintenanceOperationResultCodeTypes.RetryLater: + return "RetryLater"; + case MaintenanceOperationResultCodeTypes.MaintenanceAborted: + return "MaintenanceAborted"; + case MaintenanceOperationResultCodeTypes.MaintenanceCompleted: + return "MaintenanceCompleted"; + } + return null; + } + + internal static MaintenanceOperationResultCodeTypes? ParseMaintenanceOperationResultCodeTypes(this string value) + { + switch( value ) + { + case "None": + return MaintenanceOperationResultCodeTypes.None; + case "RetryLater": + return MaintenanceOperationResultCodeTypes.RetryLater; + case "MaintenanceAborted": + return MaintenanceOperationResultCodeTypes.MaintenanceAborted; + case "MaintenanceCompleted": + return MaintenanceOperationResultCodeTypes.MaintenanceCompleted; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceRedeployStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceRedeployStatus.cs new file mode 100644 index 000000000000..167a3bdf7f87 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/MaintenanceRedeployStatus.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Maintenance Operation Status. + /// + public partial class MaintenanceRedeployStatus + { + /// + /// Initializes a new instance of the MaintenanceRedeployStatus class. + /// + public MaintenanceRedeployStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceRedeployStatus class. + /// + /// True, if + /// customer is allowed to perform Maintenance. + /// Start Time for the Pre + /// Maintenance Window. + /// End Time for the Pre + /// Maintenance Window. + /// Start Time for the + /// Maintenance Window. + /// End Time for the Maintenance + /// Window. + /// The Last Maintenance + /// Operation Result Code. Possible values include: 'None', + /// 'RetryLater', 'MaintenanceAborted', 'MaintenanceCompleted' + /// Message returned for the last + /// Maintenance Operation. + public MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed = default(bool?), System.DateTime? preMaintenanceWindowStartTime = default(System.DateTime?), System.DateTime? preMaintenanceWindowEndTime = default(System.DateTime?), System.DateTime? maintenanceWindowStartTime = default(System.DateTime?), System.DateTime? maintenanceWindowEndTime = default(System.DateTime?), MaintenanceOperationResultCodeTypes? lastOperationResultCode = default(MaintenanceOperationResultCodeTypes?), string lastOperationMessage = default(string)) + { + IsCustomerInitiatedMaintenanceAllowed = isCustomerInitiatedMaintenanceAllowed; + PreMaintenanceWindowStartTime = preMaintenanceWindowStartTime; + PreMaintenanceWindowEndTime = preMaintenanceWindowEndTime; + MaintenanceWindowStartTime = maintenanceWindowStartTime; + MaintenanceWindowEndTime = maintenanceWindowEndTime; + LastOperationResultCode = lastOperationResultCode; + LastOperationMessage = lastOperationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets true, if customer is allowed to perform Maintenance. + /// + [JsonProperty(PropertyName = "isCustomerInitiatedMaintenanceAllowed")] + public bool? IsCustomerInitiatedMaintenanceAllowed { get; set; } + + /// + /// Gets or sets start Time for the Pre Maintenance Window. + /// + [JsonProperty(PropertyName = "preMaintenanceWindowStartTime")] + public System.DateTime? PreMaintenanceWindowStartTime { get; set; } + + /// + /// Gets or sets end Time for the Pre Maintenance Window. + /// + [JsonProperty(PropertyName = "preMaintenanceWindowEndTime")] + public System.DateTime? PreMaintenanceWindowEndTime { get; set; } + + /// + /// Gets or sets start Time for the Maintenance Window. + /// + [JsonProperty(PropertyName = "maintenanceWindowStartTime")] + public System.DateTime? MaintenanceWindowStartTime { get; set; } + + /// + /// Gets or sets end Time for the Maintenance Window. + /// + [JsonProperty(PropertyName = "maintenanceWindowEndTime")] + public System.DateTime? MaintenanceWindowEndTime { get; set; } + + /// + /// Gets or sets the Last Maintenance Operation Result Code. Possible + /// values include: 'None', 'RetryLater', 'MaintenanceAborted', + /// 'MaintenanceCompleted' + /// + [JsonProperty(PropertyName = "lastOperationResultCode")] + public MaintenanceOperationResultCodeTypes? LastOperationResultCode { get; set; } + + /// + /// Gets or sets message returned for the last Maintenance Operation. + /// + [JsonProperty(PropertyName = "lastOperationMessage")] + public string LastOperationMessage { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedArtifact.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedArtifact.cs new file mode 100644 index 000000000000..07cc6d49434b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedArtifact.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The managed artifact. + /// + public partial class ManagedArtifact + { + /// + /// Initializes a new instance of the ManagedArtifact class. + /// + public ManagedArtifact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedArtifact class. + /// + /// The managed artifact id. + public ManagedArtifact(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the managed artifact id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedDiskParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedDiskParameters.cs new file mode 100644 index 000000000000..d725e5cd8244 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ManagedDiskParameters.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters of a managed disk. + /// + public partial class ManagedDiskParameters : SubResource + { + /// + /// Initializes a new instance of the ManagedDiskParameters class. + /// + public ManagedDiskParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedDiskParameters class. + /// + /// Resource Id + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + /// Specifies the security profile for + /// the managed disk. + public ManagedDiskParameters(string id = default(string), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters), VMDiskSecurityProfile securityProfile = default(VMDiskSecurityProfile)) + : base(id) + { + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + SecurityProfile = securityProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + /// + /// Gets or sets specifies the security profile for the managed disk. + /// + [JsonProperty(PropertyName = "securityProfile")] + public VMDiskSecurityProfile SecurityProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkAccessPolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkAccessPolicy.cs new file mode 100644 index 000000000000..889fa06a09e9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkAccessPolicy.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for NetworkAccessPolicy. + /// + public static class NetworkAccessPolicy + { + /// + /// The disk can be exported or uploaded to from any network. + /// + public const string AllowAll = "AllowAll"; + /// + /// The disk can be exported or uploaded to using a DiskAccess + /// resource's private endpoints. + /// + public const string AllowPrivate = "AllowPrivate"; + /// + /// The disk cannot be exported. + /// + public const string DenyAll = "DenyAll"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkApiVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkApiVersion.cs new file mode 100644 index 000000000000..3513a038a3a4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkApiVersion.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for NetworkApiVersion. + /// + public static class NetworkApiVersion + { + public const string TwoZeroTwoZeroHyphenMinusOneOneHyphenMinusZeroOne = "2020-11-01"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliaryMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliaryMode.cs new file mode 100644 index 000000000000..0ecaaa4b2bb9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliaryMode.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for NetworkInterfaceAuxiliaryMode. + /// + public static class NetworkInterfaceAuxiliaryMode + { + public const string None = "None"; + public const string AcceleratedConnections = "AcceleratedConnections"; + public const string Floating = "Floating"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliarySku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliarySku.cs new file mode 100644 index 000000000000..0efa8ec4b9f7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceAuxiliarySku.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for NetworkInterfaceAuxiliarySku. + /// + public static class NetworkInterfaceAuxiliarySku + { + public const string None = "None"; + public const string A1 = "A1"; + public const string A2 = "A2"; + public const string A4 = "A4"; + public const string A8 = "A8"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceReference.cs new file mode 100644 index 000000000000..4a30f32209ba --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkInterfaceReference.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a network interface reference. + /// + [Rest.Serialization.JsonTransformation] + public partial class NetworkInterfaceReference : IResource + { + /// + /// Initializes a new instance of the NetworkInterfaceReference class. + /// + public NetworkInterfaceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfaceReference class. + /// + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// Specify what happens to the network + /// interface when the VM is deleted. Possible values include: + /// 'Delete', 'Detach' + public NetworkInterfaceReference(bool? primary = default(bool?), string deleteOption = default(string)) + { + Primary = primary; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specify what happens to the network interface when the + /// VM is deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkProfile.cs new file mode 100644 index 000000000000..a5b6fd87e02f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/NetworkProfile.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the network interfaces or the networking configuration of the + /// virtual machine. + /// + public partial class NetworkProfile + { + /// + /// Initializes a new instance of the NetworkProfile class. + /// + public NetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfile class. + /// + /// Specifies the list of resource Ids + /// for the network interfaces associated with the virtual + /// machine. + /// specifies the Microsoft.Network API + /// version used when creating networking resources in the Network + /// Interface Configurations. Possible values include: + /// '2020-11-01' + /// Specifies the + /// networking configurations that will be used to create the virtual + /// machine networking resources. + public NetworkProfile(IList networkInterfaces = default(IList), string networkApiVersion = default(string), IList networkInterfaceConfigurations = default(IList)) + { + NetworkInterfaces = networkInterfaces; + NetworkApiVersion = networkApiVersion; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the list of resource Ids for the network + /// interfaces associated with the virtual machine. + /// + [JsonProperty(PropertyName = "networkInterfaces")] + public IList NetworkInterfaces { get; set; } + + /// + /// Gets or sets specifies the Microsoft.Network API version used when + /// creating networking resources in the Network Interface + /// Configurations. Possible values include: '2020-11-01' + /// + [JsonProperty(PropertyName = "networkApiVersion")] + public string NetworkApiVersion { get; set; } + + /// + /// Gets or sets specifies the networking configurations that will be + /// used to create the virtual machine networking resources. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDisk.cs new file mode 100644 index 000000000000..cd2eca6cf0e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDisk.cs @@ -0,0 +1,225 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the operating system disk used by the + /// virtual machine. For more information about disks, see [About disks and + /// VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + public partial class OSDisk + { + /// + /// Initializes a new instance of the OSDisk class. + /// + public OSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDisk class. + /// + /// Specifies how the virtual machine should + /// be created. Possible values are: **Attach.** This value is used + /// when you are using a specialized disk to create the virtual + /// machine. **FromImage.** This value is used when you are using an + /// image to create the virtual machine. If you are using a platform + /// image, you should also use the imageReference element described + /// above. If you are using a marketplace image, you should also use + /// the plan element previously described. Possible values include: + /// 'FromImage', 'Empty', 'Attach' + /// This property allows you to specify the type + /// of the OS that is included in the disk if creating a VM from + /// user-image or a specialized VHD. Possible values are: **Windows,** + /// **Linux.**. Possible values include: 'Windows', 'Linux' + /// Specifies the encryption settings + /// for the OS Disk. Minimum api-version: 2015-06-15. + /// The disk name. + /// The virtual hard disk. + /// 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. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The defaulting + /// behavior is: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the ephemeral Disk + /// Settings for the operating system disk used by the virtual + /// machine. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. The property 'diskSizeGB' is the + /// number of bytes x 1024^3 for the disk and the value cannot be + /// larger than 1023. + /// The managed disk parameters. + /// Specifies whether OS Disk should be + /// deleted or detached upon VM deletion. Possible values are: + /// **Delete.** If this value is used, the OS disk is deleted when VM + /// is deleted. **Detach.** If this value is used, the os disk is + /// retained after VM is deleted. The default value is set to + /// **Detach**. For an ephemeral OS Disk, the default value is set to + /// **Delete**. The user cannot change the delete option for an + /// ephemeral OS Disk. Possible values include: 'Delete', + /// 'Detach' + public OSDisk(string createOption, OperatingSystemTypes? osType = default(OperatingSystemTypes?), DiskEncryptionSettings encryptionSettings = default(DiskEncryptionSettings), string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), DiffDiskSettings diffDiskSettings = default(DiffDiskSettings), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), string deleteOption = default(string)) + { + OsType = osType; + EncryptionSettings = encryptionSettings; + Name = name; + Vhd = vhd; + Image = image; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + DiffDiskSettings = diffDiskSettings; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk if creating a VM from user-image or a + /// specialized VHD. Possible values are: **Windows,** **Linux.**. + /// Possible values include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets specifies the encryption settings for the OS Disk. + /// Minimum api-version: 2015-06-15. + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public DiskEncryptionSettings EncryptionSettings { get; set; } + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the virtual hard disk. + /// + [JsonProperty(PropertyName = "vhd")] + public VirtualHardDisk Vhd { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the caching requirements. Possible values + /// are: **None,** **ReadOnly,** **ReadWrite.** The defaulting behavior + /// is: **None for Standard storage. ReadOnly for Premium storage.**. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies the ephemeral Disk Settings for the + /// operating system disk used by the virtual machine. + /// + [JsonProperty(PropertyName = "diffDiskSettings")] + public DiffDiskSettings DiffDiskSettings { get; set; } + + /// + /// Gets or sets specifies how the virtual machine should be created. + /// Possible values are: **Attach.** This value is used when you are + /// using a specialized disk to create the virtual machine. + /// **FromImage.** This value is used when you are using an image to + /// create the virtual machine. If you are using a platform image, you + /// should also use the imageReference element described above. If you + /// are using a marketplace image, you should also use the plan element + /// previously described. Possible values include: 'FromImage', + /// 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. The property 'diskSizeGB' is the number of + /// bytes x 1024^3 for the disk and the value cannot be larger than + /// 1023. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies whether OS Disk should be deleted or + /// detached upon VM deletion. Possible values are: **Delete.** If this + /// value is used, the OS disk is deleted when VM is deleted. + /// **Detach.** If this value is used, the os disk is retained after VM + /// is deleted. The default value is set to **Detach**. For an + /// ephemeral OS Disk, the default value is set to **Delete**. The user + /// cannot change the delete option for an ephemeral OS Disk. Possible + /// values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + if (EncryptionSettings != null) + { + EncryptionSettings.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImage.cs new file mode 100644 index 000000000000..67e155a05b4b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImage.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the os disk image information. + /// + public partial class OSDiskImage + { + /// + /// Initializes a new instance of the OSDiskImage class. + /// + public OSDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDiskImage class. + /// + /// The operating system of the + /// osDiskImage. Possible values include: 'Windows', 'Linux' + public OSDiskImage(OperatingSystemTypes operatingSystem) + { + OperatingSystem = operatingSystem; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operating system of the osDiskImage. Possible + /// values include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "operatingSystem")] + public OperatingSystemTypes OperatingSystem { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageEncryption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageEncryption.cs new file mode 100644 index 000000000000..0f25b4a2d4da --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageEncryption.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains encryption settings for an OS disk image. + /// + public partial class OSDiskImageEncryption : DiskImageEncryption + { + /// + /// Initializes a new instance of the OSDiskImageEncryption class. + /// + public OSDiskImageEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDiskImageEncryption class. + /// + /// A relative URI containing the + /// resource ID of the disk encryption set. + /// This property specifies the security + /// profile of an OS disk image. + public OSDiskImageEncryption(string diskEncryptionSetId = default(string), OSDiskImageSecurityProfile securityProfile = default(OSDiskImageSecurityProfile)) + : base(diskEncryptionSetId) + { + SecurityProfile = securityProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the security profile of an OS + /// disk image. + /// + [JsonProperty(PropertyName = "securityProfile")] + public OSDiskImageSecurityProfile SecurityProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageSecurityProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageSecurityProfile.cs new file mode 100644 index 000000000000..0db8d04bc948 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSDiskImageSecurityProfile.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains security profile for an OS disk image. + /// + public partial class OSDiskImageSecurityProfile + { + /// + /// Initializes a new instance of the OSDiskImageSecurityProfile class. + /// + public OSDiskImageSecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDiskImageSecurityProfile class. + /// + /// confidential VM + /// encryption types. Possible values include: + /// 'EncryptedVMGuestStateOnlyWithPmk', 'EncryptedWithPmk', + /// 'EncryptedWithCmk' + /// secure VM disk encryption + /// set id + public OSDiskImageSecurityProfile(string confidentialVMEncryptionType = default(string), string secureVMDiskEncryptionSetId = default(string)) + { + ConfidentialVMEncryptionType = confidentialVMEncryptionType; + SecureVMDiskEncryptionSetId = secureVMDiskEncryptionSetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets confidential VM encryption types. Possible values + /// include: 'EncryptedVMGuestStateOnlyWithPmk', 'EncryptedWithPmk', + /// 'EncryptedWithCmk' + /// + [JsonProperty(PropertyName = "confidentialVMEncryptionType")] + public string ConfidentialVMEncryptionType { get; set; } + + /// + /// Gets or sets secure VM disk encryption set id + /// + [JsonProperty(PropertyName = "secureVMDiskEncryptionSetId")] + public string SecureVMDiskEncryptionSetId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamily.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamily.cs new file mode 100644 index 000000000000..9320452adf79 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamily.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service OS family. + /// + public partial class OSFamily + { + /// + /// Initializes a new instance of the OSFamily class. + /// + public OSFamily() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSFamily class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource location. + public OSFamily(string id = default(string), string name = default(string), string type = default(string), string location = default(string), OSFamilyProperties properties = default(OSFamilyProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public OSFamilyProperties Properties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamilyProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamilyProperties.cs new file mode 100644 index 000000000000..1a47ad508b6d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSFamilyProperties.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// OS family properties. + /// + public partial class OSFamilyProperties + { + /// + /// Initializes a new instance of the OSFamilyProperties class. + /// + public OSFamilyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSFamilyProperties class. + /// + /// The OS family name. + /// The OS family label. + /// List of OS versions belonging to this + /// family. + public OSFamilyProperties(string name = default(string), string label = default(string), IList versions = default(IList)) + { + Name = name; + Label = label; + Versions = versions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the OS family name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the OS family label. + /// + [JsonProperty(PropertyName = "label")] + public string Label { get; private set; } + + /// + /// Gets list of OS versions belonging to this family. + /// + [JsonProperty(PropertyName = "versions")] + public IList Versions { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSImageNotificationProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSImageNotificationProfile.cs new file mode 100644 index 000000000000..0a2ffc4f021f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSImageNotificationProfile.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class OSImageNotificationProfile + { + /// + /// Initializes a new instance of the OSImageNotificationProfile class. + /// + public OSImageNotificationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSImageNotificationProfile class. + /// + /// Length of time a Virtual Machine + /// being reimaged or having its OS upgraded will have to potentially + /// approve the OS Image Scheduled Event before the event is auto + /// approved (timed out). The configuration is specified in ISO 8601 + /// format, and the value must be 15 minutes (PT15M) + /// Specifies whether the OS Image Scheduled event + /// is enabled or disabled. + public OSImageNotificationProfile(string notBeforeTimeout = default(string), bool? enable = default(bool?)) + { + NotBeforeTimeout = notBeforeTimeout; + Enable = enable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets length of time a Virtual Machine being reimaged or + /// having its OS upgraded will have to potentially approve the OS + /// Image Scheduled Event before the event is auto approved (timed + /// out). The configuration is specified in ISO 8601 format, and the + /// value must be 15 minutes (PT15M) + /// + [JsonProperty(PropertyName = "notBeforeTimeout")] + public string NotBeforeTimeout { get; set; } + + /// + /// Gets or sets specifies whether the OS Image Scheduled event is + /// enabled or disabled. + /// + [JsonProperty(PropertyName = "enable")] + public bool? Enable { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfile.cs new file mode 100644 index 000000000000..f02183690429 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfile.cs @@ -0,0 +1,240 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the operating system settings for the virtual machine. Some + /// of the settings cannot be changed once VM is provisioned. + /// + public partial class OSProfile + { + /// + /// Initializes a new instance of the OSProfile class. + /// + public OSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSProfile class. + /// + /// Specifies the host OS name of the + /// virtual machine. This name cannot be updated after the VM is + /// created. **Max-length (Windows):** 15 characters. **Max-length + /// (Linux):** 64 characters. For naming conventions and restrictions + /// see [Azure infrastructure services implementation + /// guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). + /// Specifies the name of the administrator + /// account. <br><br> This property cannot be updated after + /// the VM is created. <br><br> **Windows-only + /// restriction:** Cannot end in "." <br><br> **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// <br><br> **Minimum-length (Linux):** 1 character + /// <br><br> **Max-length (Linux):** 64 characters + /// <br><br> **Max-length (Windows):** 20 + /// characters. + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// Specifies a base-64 encoded string of + /// custom data. The base-64 encoded string is decoded to a binary + /// array that is saved as a file on the Virtual Machine. The maximum + /// length of the binary array is 65535 bytes. **Note: Do not pass any + /// secrets or passwords in customData property.** This property cannot + /// be updated after the VM is created. The property 'customData' is + /// passed to the VM to be saved as a file, for more information see + /// [Custom Data on Azure + /// VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). + /// For using cloud-init for your Linux VM, see [Using cloud-init to + /// customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + /// Specifies Windows operating + /// system settings on the virtual machine. + /// Specifies the Linux operating + /// system settings on the virtual machine. For a list of supported + /// Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// Specifies set of certificates that should be + /// installed onto the virtual machine. To install certificates on a + /// virtual machine it is recommended to use the [Azure Key Vault + /// virtual machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// Specifies whether extension + /// operations should be allowed on the virtual machine. This may only + /// be set to False when no extensions are present on the virtual + /// machine. + /// Optional property which + /// must either be set to True or omitted. + public OSProfile(string computerName = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList), bool? allowExtensionOperations = default(bool?), bool? requireGuestProvisionSignal = default(bool?)) + { + ComputerName = computerName; + AdminUsername = adminUsername; + AdminPassword = adminPassword; + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + AllowExtensionOperations = allowExtensionOperations; + RequireGuestProvisionSignal = requireGuestProvisionSignal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the host OS name of the virtual machine. + /// This name cannot be updated after the VM is created. **Max-length + /// (Windows):** 15 characters. **Max-length (Linux):** 64 characters. + /// For naming conventions and restrictions see [Azure infrastructure + /// services implementation + /// guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). + /// + [JsonProperty(PropertyName = "computerName")] + public string ComputerName { get; set; } + + /// + /// Gets or sets specifies the name of the administrator account. + /// &lt;br&gt;&lt;br&gt; This property cannot be + /// updated after the VM is created. + /// &lt;br&gt;&lt;br&gt; **Windows-only restriction:** + /// Cannot end in "." &lt;br&gt;&lt;br&gt; **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Linux):** 1 + /// character &lt;br&gt;&lt;br&gt; **Max-length + /// (Linux):** 64 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 20 characters. + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies a base-64 encoded string of custom data. The + /// base-64 encoded string is decoded to a binary array that is saved + /// as a file on the Virtual Machine. The maximum length of the binary + /// array is 65535 bytes. **Note: Do not pass any secrets or passwords + /// in customData property.** This property cannot be updated after the + /// VM is created. The property 'customData' is passed to the VM to be + /// saved as a file, for more information see [Custom Data on Azure + /// VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). + /// For using cloud-init for your Linux VM, see [Using cloud-init to + /// customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets specifies Windows operating system settings on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets specifies the Linux operating system settings on the + /// virtual machine. For a list of supported Linux distributions, see + /// [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the virtual machine. To install certificates on a virtual + /// machine it is recommended to use the [Azure Key Vault virtual + /// machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + /// + /// Gets or sets specifies whether extension operations should be + /// allowed on the virtual machine. This may only be set to False when + /// no extensions are present on the virtual machine. + /// + [JsonProperty(PropertyName = "allowExtensionOperations")] + public bool? AllowExtensionOperations { get; set; } + + /// + /// Gets or sets optional property which must either be set to True or + /// omitted. + /// + [JsonProperty(PropertyName = "requireGuestProvisionSignal")] + public bool? RequireGuestProvisionSignal { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfileProvisioningData.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfileProvisioningData.cs new file mode 100644 index 000000000000..0248faacb5c3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSProfileProvisioningData.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Additional parameters for Reimaging Non-Ephemeral Virtual Machine. + /// + public partial class OSProfileProvisioningData + { + /// + /// Initializes a new instance of the OSProfileProvisioningData class. + /// + public OSProfileProvisioningData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSProfileProvisioningData class. + /// + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// Specifies a base-64 encoded string of + /// custom data. The base-64 encoded string is decoded to a binary + /// array that is saved as a file on the Virtual Machine. The maximum + /// length of the binary array is 65535 bytes. **Note: Do not pass any + /// secrets or passwords in customData property.** This property cannot + /// be updated after the VM is created. The property customData is + /// passed to the VM to be saved as a file, for more information see + /// [Custom Data on Azure + /// VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). + /// If using cloud-init for your Linux VM, see [Using cloud-init to + /// customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + public OSProfileProvisioningData(string adminPassword = default(string), string customData = default(string)) + { + AdminPassword = adminPassword; + CustomData = customData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies a base-64 encoded string of custom data. The + /// base-64 encoded string is decoded to a binary array that is saved + /// as a file on the Virtual Machine. The maximum length of the binary + /// array is 65535 bytes. **Note: Do not pass any secrets or passwords + /// in customData property.** This property cannot be updated after the + /// VM is created. The property customData is passed to the VM to be + /// saved as a file, for more information see [Custom Data on Azure + /// VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). + /// If using cloud-init for your Linux VM, see [Using cloud-init to + /// customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersion.cs new file mode 100644 index 000000000000..e7ed62060374 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersion.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a cloud service OS version. + /// + public partial class OSVersion + { + /// + /// Initializes a new instance of the OSVersion class. + /// + public OSVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSVersion class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource location. + public OSVersion(string id = default(string), string name = default(string), string type = default(string), string location = default(string), OSVersionProperties properties = default(OSVersionProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public OSVersionProperties Properties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionProperties.cs new file mode 100644 index 000000000000..1c58d145e87d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionProperties.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// OS version properties. + /// + public partial class OSVersionProperties + { + /// + /// Initializes a new instance of the OSVersionProperties class. + /// + public OSVersionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSVersionProperties class. + /// + /// The family of this OS version. + /// The family label of this OS + /// version. + /// The OS version. + /// The OS version label. + /// Specifies whether this is the default OS + /// version for its family. + /// Specifies whether this OS version is + /// active. + public OSVersionProperties(string family = default(string), string familyLabel = default(string), string version = default(string), string label = default(string), bool? isDefault = default(bool?), bool? isActive = default(bool?)) + { + Family = family; + FamilyLabel = familyLabel; + Version = version; + Label = label; + IsDefault = isDefault; + IsActive = isActive; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the family of this OS version. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// Gets the family label of this OS version. + /// + [JsonProperty(PropertyName = "familyLabel")] + public string FamilyLabel { get; private set; } + + /// + /// Gets the OS version. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the OS version label. + /// + [JsonProperty(PropertyName = "label")] + public string Label { get; private set; } + + /// + /// Gets specifies whether this is the default OS version for its + /// family. + /// + [JsonProperty(PropertyName = "isDefault")] + public bool? IsDefault { get; private set; } + + /// + /// Gets specifies whether this OS version is active. + /// + [JsonProperty(PropertyName = "isActive")] + public bool? IsActive { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionPropertiesBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionPropertiesBase.cs new file mode 100644 index 000000000000..d408b127b348 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OSVersionPropertiesBase.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Configuration view of an OS version. + /// + public partial class OSVersionPropertiesBase + { + /// + /// Initializes a new instance of the OSVersionPropertiesBase class. + /// + public OSVersionPropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSVersionPropertiesBase class. + /// + /// The OS version. + /// The OS version label. + /// Specifies whether this is the default OS + /// version for its family. + /// Specifies whether this OS version is + /// active. + public OSVersionPropertiesBase(string version = default(string), string label = default(string), bool? isDefault = default(bool?), bool? isActive = default(bool?)) + { + Version = version; + Label = label; + IsDefault = isDefault; + IsActive = isActive; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the OS version. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the OS version label. + /// + [JsonProperty(PropertyName = "label")] + public string Label { get; private set; } + + /// + /// Gets specifies whether this is the default OS version for its + /// family. + /// + [JsonProperty(PropertyName = "isDefault")] + public bool? IsDefault { get; private set; } + + /// + /// Gets specifies whether this OS version is active. + /// + [JsonProperty(PropertyName = "isActive")] + public bool? IsActive { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemStateTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemStateTypes.cs new file mode 100644 index 000000000000..3c2ab5cad837 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemStateTypes.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OperatingSystemStateTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OperatingSystemStateTypes + { + /// + /// Generalized image. Needs to be provisioned during deployment time. + /// + [EnumMember(Value = "Generalized")] + Generalized, + /// + /// Specialized image. Contains already provisioned OS Disk. + /// + [EnumMember(Value = "Specialized")] + Specialized + } + internal static class OperatingSystemStateTypesEnumExtension + { + internal static string ToSerializedValue(this OperatingSystemStateTypes? value) + { + return value == null ? null : ((OperatingSystemStateTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OperatingSystemStateTypes value) + { + switch( value ) + { + case OperatingSystemStateTypes.Generalized: + return "Generalized"; + case OperatingSystemStateTypes.Specialized: + return "Specialized"; + } + return null; + } + + internal static OperatingSystemStateTypes? ParseOperatingSystemStateTypes(this string value) + { + switch( value ) + { + case "Generalized": + return OperatingSystemStateTypes.Generalized; + case "Specialized": + return OperatingSystemStateTypes.Specialized; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemType.cs new file mode 100644 index 000000000000..924d01f97423 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for OperatingSystemType. + /// + public static class OperatingSystemType + { + public const string Windows = "Windows"; + public const string Linux = "Linux"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemTypes.cs new file mode 100644 index 000000000000..e9e9dc929b25 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OperatingSystemTypes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OperatingSystemTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OperatingSystemTypes + { + [EnumMember(Value = "Windows")] + Windows, + [EnumMember(Value = "Linux")] + Linux + } + internal static class OperatingSystemTypesEnumExtension + { + internal static string ToSerializedValue(this OperatingSystemTypes? value) + { + return value == null ? null : ((OperatingSystemTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OperatingSystemTypes value) + { + switch( value ) + { + case OperatingSystemTypes.Windows: + return "Windows"; + case OperatingSystemTypes.Linux: + return "Linux"; + } + return null; + } + + internal static OperatingSystemTypes? ParseOperatingSystemTypes(this string value) + { + switch( value ) + { + case "Windows": + return OperatingSystemTypes.Windows; + case "Linux": + return OperatingSystemTypes.Linux; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationMode.cs new file mode 100644 index 000000000000..bf55423160dc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for OrchestrationMode. + /// + public static class OrchestrationMode + { + public const string Uniform = "Uniform"; + public const string Flexible = "Flexible"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceNames.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceNames.cs new file mode 100644 index 000000000000..30a42bbd138a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceNames.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for OrchestrationServiceNames. + /// + public static class OrchestrationServiceNames + { + public const string AutomaticRepairs = "AutomaticRepairs"; + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceState.cs new file mode 100644 index 000000000000..78a78c39724c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for OrchestrationServiceState. + /// + public static class OrchestrationServiceState + { + public const string NotRunning = "NotRunning"; + public const string Running = "Running"; + public const string Suspended = "Suspended"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateAction.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateAction.cs new file mode 100644 index 000000000000..85263f3144c7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateAction.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for OrchestrationServiceStateAction. + /// + public static class OrchestrationServiceStateAction + { + public const string Resume = "Resume"; + public const string Suspend = "Suspend"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateInput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateInput.cs new file mode 100644 index 000000000000..2eb5ebd10d94 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceStateInput.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The input for OrchestrationServiceState + /// + public partial class OrchestrationServiceStateInput + { + /// + /// Initializes a new instance of the OrchestrationServiceStateInput + /// class. + /// + public OrchestrationServiceStateInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrchestrationServiceStateInput + /// class. + /// + /// The name of the service. Possible values + /// include: 'AutomaticRepairs', + /// 'DummyOrchestrationServiceName' + /// The action to be performed. Possible values + /// include: 'Resume', 'Suspend' + public OrchestrationServiceStateInput(string serviceName, string action) + { + ServiceName = serviceName; + Action = action; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the service. Possible values include: + /// 'AutomaticRepairs' + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; set; } + + /// + /// Gets or sets the action to be performed. Possible values include: + /// 'Resume', 'Suspend' + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceName"); + } + if (Action == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Action"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceSummary.cs new file mode 100644 index 000000000000..2f398484a900 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/OrchestrationServiceSummary.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Summary for an orchestration service of a virtual machine scale set. + /// + public partial class OrchestrationServiceSummary + { + /// + /// Initializes a new instance of the OrchestrationServiceSummary + /// class. + /// + public OrchestrationServiceSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrchestrationServiceSummary + /// class. + /// + /// The name of the service. Possible values + /// include: 'AutomaticRepairs', + /// 'DummyOrchestrationServiceName' + /// The current state of the service. + /// Possible values include: 'NotRunning', 'Running', + /// 'Suspended' + public OrchestrationServiceSummary(string serviceName = default(string), string serviceState = default(string)) + { + ServiceName = serviceName; + ServiceState = serviceState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the service. Possible values include: + /// 'AutomaticRepairs' + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; private set; } + + /// + /// Gets the current state of the service. Possible values include: + /// 'NotRunning', 'Running', 'Suspended' + /// + [JsonProperty(PropertyName = "serviceState")] + public string ServiceState { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Page.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..4476c5e85d42 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Page1.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Page1.cs new file mode 100644 index 000000000000..1b1a46379dcb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PassNames.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PassNames.cs new file mode 100644 index 000000000000..9e5d5e8bc306 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PassNames.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for PassNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PassNames + { + [EnumMember(Value = "OobeSystem")] + OobeSystem + } + internal static class PassNamesEnumExtension + { + internal static string ToSerializedValue(this PassNames? value) + { + return value == null ? null : ((PassNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this PassNames value) + { + switch( value ) + { + case PassNames.OobeSystem: + return "OobeSystem"; + } + return null; + } + + internal static PassNames? ParsePassNames(this string value) + { + switch( value ) + { + case "OobeSystem": + return PassNames.OobeSystem; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PatchAssessmentState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchAssessmentState.cs new file mode 100644 index 000000000000..e38d2040f788 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchAssessmentState.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PatchAssessmentState. + /// + public static class PatchAssessmentState + { + public const string Unknown = "Unknown"; + public const string Available = "Available"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationDetail.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationDetail.cs new file mode 100644 index 000000000000..6dc51bd5402f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationDetail.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information about a specific patch that was encountered during an + /// installation action. + /// + public partial class PatchInstallationDetail + { + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + public PatchInstallationDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchInstallationDetail class. + /// + /// A unique identifier for the patch. + /// The friendly name of the patch. + /// The version string of the package. It may + /// conform to Semantic Versioning. Only applies to Linux. + /// The KBID of the patch. Only applies to Windows + /// patches. + /// The classification(s) of the patch as + /// provided by the patch publisher. + /// The state of the patch after the + /// installation operation completed. Possible values include: + /// 'Unknown', 'Installed', 'Failed', 'Excluded', 'NotSelected', + /// 'Pending' + public PatchInstallationDetail(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string installationState = default(string)) + { + PatchId = patchId; + Name = name; + Version = version; + KbId = kbId; + Classifications = classifications; + InstallationState = installationState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique identifier for the patch. + /// + [JsonProperty(PropertyName = "patchId")] + public string PatchId { get; private set; } + + /// + /// Gets the friendly name of the patch. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the version string of the package. It may conform to Semantic + /// Versioning. Only applies to Linux. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the KBID of the patch. Only applies to Windows patches. + /// + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } + + /// + /// Gets the classification(s) of the patch as provided by the patch + /// publisher. + /// + [JsonProperty(PropertyName = "classifications")] + public IList Classifications { get; private set; } + + /// + /// Gets the state of the patch after the installation operation + /// completed. Possible values include: 'Unknown', 'Installed', + /// 'Failed', 'Excluded', 'NotSelected', 'Pending' + /// + [JsonProperty(PropertyName = "installationState")] + public string InstallationState { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationState.cs new file mode 100644 index 000000000000..6ca7103442ba --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchInstallationState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PatchInstallationState. + /// + public static class PatchInstallationState + { + public const string Unknown = "Unknown"; + public const string Installed = "Installed"; + public const string Failed = "Failed"; + public const string Excluded = "Excluded"; + public const string NotSelected = "NotSelected"; + public const string Pending = "Pending"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PatchOperationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchOperationStatus.cs new file mode 100644 index 000000000000..0d9c96f755a1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchOperationStatus.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PatchOperationStatus. + /// + public static class PatchOperationStatus + { + public const string Unknown = "Unknown"; + public const string InProgress = "InProgress"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string CompletedWithWarnings = "CompletedWithWarnings"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PatchSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchSettings.cs new file mode 100644 index 000000000000..e4cd9e06e904 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PatchSettings.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies settings related to VM Guest Patching on Windows. + /// + public partial class PatchSettings + { + /// + /// Initializes a new instance of the PatchSettings class. + /// + public PatchSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchSettings class. + /// + /// Specifies the mode of VM Guest Patching to + /// IaaS virtual machine or virtual machines associated to virtual + /// machine scale set with OrchestrationMode as Flexible.<br + /// /><br /> Possible values are:<br /><br /> + /// **Manual** - You control the application of patches to a virtual + /// machine. You do this by applying patches manually inside the VM. In + /// this mode, automatic updates are disabled; the property + /// WindowsConfiguration.enableAutomaticUpdates must be false<br + /// /><br /> **AutomaticByOS** - The virtual machine will + /// automatically be updated by the OS. The property + /// WindowsConfiguration.enableAutomaticUpdates must be true. <br + /// /><br /> **AutomaticByPlatform** - the virtual machine + /// will automatically updated by the platform. The properties + /// provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates + /// must be true. Possible values include: 'Manual', 'AutomaticByOS', + /// 'AutomaticByPlatform' + /// Enables customers to patch their + /// Azure VMs without requiring a reboot. For enableHotpatching, the + /// 'provisionVMAgent' must be set to true and 'patchMode' must be set + /// to 'AutomaticByPlatform'. + /// Specifies the mode of VM Guest patch + /// assessment for the IaaS virtual machine.<br /><br /> + /// Possible values are:<br /><br /> **ImageDefault** - You + /// control the timing of patch assessments on a virtual machine.<br + /// /><br /> **AutomaticByPlatform** - The platform will + /// trigger periodic patch assessments. The property provisionVMAgent + /// must be true. Possible values include: 'ImageDefault', + /// 'AutomaticByPlatform' + /// Specifies additional + /// settings for patch mode AutomaticByPlatform in VM Guest Patching on + /// Windows. + public PatchSettings(string patchMode = default(string), bool? enableHotpatching = default(bool?), string assessmentMode = default(string), WindowsVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings = default(WindowsVMGuestPatchAutomaticByPlatformSettings)) + { + PatchMode = patchMode; + EnableHotpatching = enableHotpatching; + AssessmentMode = assessmentMode; + AutomaticByPlatformSettings = automaticByPlatformSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of VM Guest Patching to IaaS + /// virtual machine or virtual machines associated to virtual machine + /// scale set with OrchestrationMode as Flexible.&lt;br + /// /&gt;&lt;br /&gt; Possible values are:&lt;br + /// /&gt;&lt;br /&gt; **Manual** - You control the + /// application of patches to a virtual machine. You do this by + /// applying patches manually inside the VM. In this mode, automatic + /// updates are disabled; the property + /// WindowsConfiguration.enableAutomaticUpdates must be false&lt;br + /// /&gt;&lt;br /&gt; **AutomaticByOS** - The virtual + /// machine will automatically be updated by the OS. The property + /// WindowsConfiguration.enableAutomaticUpdates must be true. + /// &lt;br /&gt;&lt;br /&gt; **AutomaticByPlatform** - + /// the virtual machine will automatically updated by the platform. The + /// properties provisionVMAgent and + /// WindowsConfiguration.enableAutomaticUpdates must be true. Possible + /// values include: 'Manual', 'AutomaticByOS', 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "patchMode")] + public string PatchMode { get; set; } + + /// + /// Gets or sets enables customers to patch their Azure VMs without + /// requiring a reboot. For enableHotpatching, the 'provisionVMAgent' + /// must be set to true and 'patchMode' must be set to + /// 'AutomaticByPlatform'. + /// + [JsonProperty(PropertyName = "enableHotpatching")] + public bool? EnableHotpatching { get; set; } + + /// + /// Gets or sets specifies the mode of VM Guest patch assessment for + /// the IaaS virtual machine.&lt;br /&gt;&lt;br /&gt; + /// Possible values are:&lt;br /&gt;&lt;br /&gt; + /// **ImageDefault** - You control the timing of patch assessments on a + /// virtual machine.&lt;br /&gt;&lt;br /&gt; + /// **AutomaticByPlatform** - The platform will trigger periodic patch + /// assessments. The property provisionVMAgent must be true. Possible + /// values include: 'ImageDefault', 'AutomaticByPlatform' + /// + [JsonProperty(PropertyName = "assessmentMode")] + public string AssessmentMode { get; set; } + + /// + /// Gets or sets specifies additional settings for patch mode + /// AutomaticByPlatform in VM Guest Patching on Windows. + /// + [JsonProperty(PropertyName = "automaticByPlatformSettings")] + public WindowsVMGuestPatchAutomaticByPlatformSettings AutomaticByPlatformSettings { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PirCommunityGalleryResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PirCommunityGalleryResource.cs new file mode 100644 index 000000000000..cf1467acdc28 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PirCommunityGalleryResource.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base information about the community gallery resource in pir. + /// + [Rest.Serialization.JsonTransformation] + public partial class PirCommunityGalleryResource + { + /// + /// Initializes a new instance of the PirCommunityGalleryResource + /// class. + /// + public PirCommunityGalleryResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirCommunityGalleryResource + /// class. + /// + /// Resource name + /// Resource location + /// Resource type + /// The unique id of this community + /// gallery. + public PirCommunityGalleryResource(string name = default(string), string location = default(string), string type = default(string), string uniqueId = default(string)) + { + Name = name; + Location = location; + Type = type; + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the unique id of this community gallery. + /// + [JsonProperty(PropertyName = "identifier.uniqueId")] + public string UniqueId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PirResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PirResource.cs new file mode 100644 index 000000000000..7a1e494e0651 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PirResource.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class PirResource + { + /// + /// Initializes a new instance of the PirResource class. + /// + public PirResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirResource class. + /// + /// Resource name + /// Resource location + public PirResource(string name = default(string), string location = default(string)) + { + Name = name; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PirSharedGalleryResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PirSharedGalleryResource.cs new file mode 100644 index 000000000000..1ee9785ad48c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PirSharedGalleryResource.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base information about the shared gallery resource in pir. + /// + [Rest.Serialization.JsonTransformation] + public partial class PirSharedGalleryResource : PirResource + { + /// + /// Initializes a new instance of the PirSharedGalleryResource class. + /// + public PirSharedGalleryResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PirSharedGalleryResource class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + public PirSharedGalleryResource(string name = default(string), string location = default(string), string uniqueId = default(string)) + : base(name, location) + { + UniqueId = uniqueId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the unique id of this shared gallery. + /// + [JsonProperty(PropertyName = "identifier.uniqueId")] + public string UniqueId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Plan.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Plan.cs new file mode 100644 index 000000000000..73554c036fdd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Plan.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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**. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// The plan ID. + /// The publisher ID. + /// Specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// The promotion code. + public Plan(string name = default(string), string publisher = default(string), string product = default(string), string promotionCode = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets the promotion code. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolation.cs new file mode 100644 index 000000000000..e359888274a2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolation.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A policy violation reported against a gallery artifact. + /// + public partial class PolicyViolation + { + /// + /// Initializes a new instance of the PolicyViolation class. + /// + public PolicyViolation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyViolation class. + /// + /// Describes the nature of the policy + /// violation. Possible values include: 'Other', 'ImageFlaggedUnsafe', + /// 'CopyrightValidation', 'IpTheft' + /// Describes specific details about why this + /// policy violation was reported. + public PolicyViolation(string category = default(string), string details = default(string)) + { + Category = category; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the nature of the policy violation. Possible + /// values include: 'Other', 'ImageFlaggedUnsafe', + /// 'CopyrightValidation', 'IpTheft' + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets describes specific details about why this policy + /// violation was reported. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolationCategory.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolationCategory.cs new file mode 100644 index 000000000000..951ef2663c78 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PolicyViolationCategory.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PolicyViolationCategory. + /// + public static class PolicyViolationCategory + { + public const string Other = "Other"; + public const string ImageFlaggedUnsafe = "ImageFlaggedUnsafe"; + public const string CopyrightValidation = "CopyrightValidation"; + public const string IpTheft = "IpTheft"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PriorityMixPolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PriorityMixPolicy.cs new file mode 100644 index 000000000000..14e433cc79ed --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PriorityMixPolicy.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the target splits for Spot and Regular priority VMs within a + /// scale set with flexible orchestration mode. With this property the + /// customer is able to specify the base number of regular priority VMs + /// created as the VMSS flex instance scales out and the split between Spot + /// and Regular priority VMs after this base target has been reached. + /// + public partial class PriorityMixPolicy + { + /// + /// Initializes a new instance of the PriorityMixPolicy class. + /// + public PriorityMixPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PriorityMixPolicy class. + /// + /// The base number of regular + /// priority VMs that will be created in this scale set as it scales + /// out. + /// The percentage of + /// VM instances, after the base regular priority count has been + /// reached, that are expected to use regular priority. + public PriorityMixPolicy(int? baseRegularPriorityCount = default(int?), int? regularPriorityPercentageAboveBase = default(int?)) + { + BaseRegularPriorityCount = baseRegularPriorityCount; + RegularPriorityPercentageAboveBase = regularPriorityPercentageAboveBase; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the base number of regular priority VMs that will be + /// created in this scale set as it scales out. + /// + [JsonProperty(PropertyName = "baseRegularPriorityCount")] + public int? BaseRegularPriorityCount { get; set; } + + /// + /// Gets or sets the percentage of VM instances, after the base regular + /// priority count has been reached, that are expected to use regular + /// priority. + /// + [JsonProperty(PropertyName = "regularPriorityPercentageAboveBase")] + public int? RegularPriorityPercentageAboveBase { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BaseRegularPriorityCount != null) + { + if (BaseRegularPriorityCount < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "BaseRegularPriorityCount", 0); + } + } + if (RegularPriorityPercentageAboveBase != null) + { + if (RegularPriorityPercentageAboveBase > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "RegularPriorityPercentageAboveBase", 100); + } + if (RegularPriorityPercentageAboveBase < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RegularPriorityPercentageAboveBase", 0); + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpoint.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..ef7080558242 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..5f351eb8705f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : IResource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between DiskAccess + /// and Virtual Network. + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + /// private endpoint connection Id + /// private endpoint connection name + /// private endpoint connection type + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; private set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between DiskAccess and Virtual Network. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets private endpoint connection Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets private endpoint connection name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets private endpoint connection type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..a5faa7278f6f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..7563361c9555 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..5c8516507969 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource DNS zone + /// name. + /// private link resource Id + /// private link resource name + /// private link resource type + public PrivateLinkResource(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), string id = default(string), string name = default(string), string type = default(string)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Gets private link resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets private link resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets private link resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResourceListResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..74345e724609 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkResourceListResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..fd42da8e3751 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on + /// the service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PropertyUpdatesInProgress.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PropertyUpdatesInProgress.cs new file mode 100644 index 000000000000..c929b3b9f106 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PropertyUpdatesInProgress.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the disk for which update is pending. + /// + public partial class PropertyUpdatesInProgress + { + /// + /// Initializes a new instance of the PropertyUpdatesInProgress class. + /// + public PropertyUpdatesInProgress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PropertyUpdatesInProgress class. + /// + /// The target performance tier of the disk if + /// a tier change operation is in progress. + public PropertyUpdatesInProgress(string targetTier = default(string)) + { + TargetTier = targetTier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target performance tier of the disk if a tier + /// change operation is in progress. + /// + [JsonProperty(PropertyName = "targetTier")] + public string TargetTier { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProtocolTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProtocolTypes.cs new file mode 100644 index 000000000000..a8ac8d6cedb0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProtocolTypes.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ProtocolTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ProtocolTypes + { + [EnumMember(Value = "Http")] + Http, + [EnumMember(Value = "Https")] + Https + } + internal static class ProtocolTypesEnumExtension + { + internal static string ToSerializedValue(this ProtocolTypes? value) + { + return value == null ? null : ((ProtocolTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ProtocolTypes value) + { + switch( value ) + { + case ProtocolTypes.Http: + return "Http"; + case ProtocolTypes.Https: + return "Https"; + } + return null; + } + + internal static ProtocolTypes? ParseProtocolTypes(this string value) + { + switch( value ) + { + case "Http": + return ProtocolTypes.Http; + case "Https": + return ProtocolTypes.Https; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroup.cs new file mode 100644 index 000000000000..9b91303c48c3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroup.cs @@ -0,0 +1,142 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the proximity placement group. + /// + [Rest.Serialization.JsonTransformation] + public partial class ProximityPlacementGroup : Resource + { + /// + /// Initializes a new instance of the ProximityPlacementGroup class. + /// + public ProximityPlacementGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProximityPlacementGroup class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// 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. Possible values include: 'Standard', + /// 'Ultra' + /// A list of references to all virtual + /// machines in the proximity placement group. + /// A list of references to all + /// virtual machine scale sets in the proximity placement + /// group. + /// A list of references to all + /// availability sets in the proximity placement group. + /// Describes colocation status of the + /// Proximity Placement Group. + /// Specifies the user intent of the proximity + /// placement group. + /// Specifies the Availability Zone where virtual + /// machine, virtual machine scale set or availability set associated + /// with the proximity placement group can be created. + public ProximityPlacementGroup(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string proximityPlacementGroupType = default(string), IList virtualMachines = default(IList), IList virtualMachineScaleSets = default(IList), IList availabilitySets = default(IList), InstanceViewStatus colocationStatus = default(InstanceViewStatus), ProximityPlacementGroupPropertiesIntent intent = default(ProximityPlacementGroupPropertiesIntent), IList zones = default(IList)) + : base(location, id, name, type, tags) + { + ProximityPlacementGroupType = proximityPlacementGroupType; + VirtualMachines = virtualMachines; + VirtualMachineScaleSets = virtualMachineScaleSets; + AvailabilitySets = availabilitySets; + ColocationStatus = colocationStatus; + Intent = intent; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// Possible values include: 'Standard', 'Ultra' + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroupType")] + public string ProximityPlacementGroupType { get; set; } + + /// + /// Gets a list of references to all virtual machines in the proximity + /// placement group. + /// + [JsonProperty(PropertyName = "properties.virtualMachines")] + public IList VirtualMachines { get; private set; } + + /// + /// Gets a list of references to all virtual machine scale sets in the + /// proximity placement group. + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSets")] + public IList VirtualMachineScaleSets { get; private set; } + + /// + /// Gets a list of references to all availability sets in the proximity + /// placement group. + /// + [JsonProperty(PropertyName = "properties.availabilitySets")] + public IList AvailabilitySets { get; private set; } + + /// + /// Gets or sets describes colocation status of the Proximity Placement + /// Group. + /// + [JsonProperty(PropertyName = "properties.colocationStatus")] + public InstanceViewStatus ColocationStatus { get; set; } + + /// + /// Gets or sets specifies the user intent of the proximity placement + /// group. + /// + [JsonProperty(PropertyName = "properties.intent")] + public ProximityPlacementGroupPropertiesIntent Intent { get; set; } + + /// + /// Gets or sets specifies the Availability Zone where virtual machine, + /// virtual machine scale set or availability set associated with the + /// proximity placement group can be created. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs new file mode 100644 index 000000000000..9b3bb104ae2a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the user intent of the proximity placement group. + /// + public partial class ProximityPlacementGroupPropertiesIntent + { + /// + /// Initializes a new instance of the + /// ProximityPlacementGroupPropertiesIntent class. + /// + public ProximityPlacementGroupPropertiesIntent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ProximityPlacementGroupPropertiesIntent class. + /// + /// Specifies possible sizes of virtual machines + /// that can be created in the proximity placement group. + public ProximityPlacementGroupPropertiesIntent(IList vmSizes = default(IList)) + { + VmSizes = vmSizes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies possible sizes of virtual machines that can + /// be created in the proximity placement group. + /// + [JsonProperty(PropertyName = "vmSizes")] + public IList VmSizes { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupType.cs new file mode 100644 index 000000000000..9d5fc5433049 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ProximityPlacementGroupType. + /// + public static class ProximityPlacementGroupType + { + public const string Standard = "Standard"; + public const string Ultra = "Ultra"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupUpdate.cs new file mode 100644 index 000000000000..0343a07d68f6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProximityPlacementGroupUpdate.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the proximity placement group. + /// + public partial class ProximityPlacementGroupUpdate : UpdateResource + { + /// + /// Initializes a new instance of the ProximityPlacementGroupUpdate + /// class. + /// + public ProximityPlacementGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProximityPlacementGroupUpdate + /// class. + /// + /// Resource tags + public ProximityPlacementGroupUpdate(IDictionary tags = default(IDictionary)) + : base(tags) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyOnlyResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyOnlyResource.cs new file mode 100644 index 000000000000..757a9e381e44 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyOnlyResource.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The ProxyOnly Resource model definition. + /// + public partial class ProxyOnlyResource + { + /// + /// Initializes a new instance of the ProxyOnlyResource class. + /// + public ProxyOnlyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyOnlyResource class. + /// + /// Resource Id + /// Resource name + /// Resource type + public ProxyOnlyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..d30ac30ee4ef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ProxyResource.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for an Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Resource Id + /// Resource name + /// Resource type + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSku.cs new file mode 100644 index 000000000000..7c58f0e6e932 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSku.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the public IP Sku. It can only be set with OrchestrationMode + /// as Flexible. + /// + public partial class PublicIPAddressSku + { + /// + /// Initializes a new instance of the PublicIPAddressSku class. + /// + public PublicIPAddressSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PublicIPAddressSku class. + /// + /// Specify public IP sku name. Possible values + /// include: 'Basic', 'Standard' + /// Specify public IP sku tier. Possible values + /// include: 'Regional', 'Global' + public PublicIPAddressSku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specify public IP sku name. Possible values include: + /// 'Basic', 'Standard' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specify public IP sku tier. Possible values include: + /// 'Regional', 'Global' + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuName.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuName.cs new file mode 100644 index 000000000000..aff7662690df --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuName.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PublicIPAddressSkuName. + /// + public static class PublicIPAddressSkuName + { + public const string Basic = "Basic"; + public const string Standard = "Standard"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuTier.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuTier.cs new file mode 100644 index 000000000000..6e4f2b7c20cc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAddressSkuTier.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PublicIPAddressSkuTier. + /// + public static class PublicIPAddressSkuTier + { + public const string Regional = "Regional"; + public const string Global = "Global"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAllocationMethod.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAllocationMethod.cs new file mode 100644 index 000000000000..da2ad835e97f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicIPAllocationMethod.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PublicIPAllocationMethod. + /// + public static class PublicIPAllocationMethod + { + public const string Dynamic = "Dynamic"; + public const string Static = "Static"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PublicNetworkAccess.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..bf95aa396f39 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + /// + /// You can generate a SAS URI to access the underlying data of the + /// disk publicly on the internet when NetworkAccessPolicy is set to + /// AllowAll. You can access the data via the SAS URI only from your + /// trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. + /// + public const string Enabled = "Enabled"; + /// + /// You cannot access the underlying data of the disk publicly on the + /// internet even when NetworkAccessPolicy is set to AllowAll. You can + /// access the data via the SAS URI only from your trusted Azure VNET + /// when NetworkAccessPolicy is set to AllowPrivate. + /// + public const string Disabled = "Disabled"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/PurchasePlan.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/PurchasePlan.cs new file mode 100644 index 000000000000..c52361695cf9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/PurchasePlan.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Used for establishing the purchase context of any 3rd Party artifact + /// through MarketPlace. + /// + public partial class PurchasePlan + { + /// + /// Initializes a new instance of the PurchasePlan class. + /// + public PurchasePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PurchasePlan class. + /// + /// The publisher ID. + /// The plan ID. + /// Specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// The Offer Promotion Code. + public PurchasePlan(string publisher, string name, string product, string promotionCode = default(string)) + { + Publisher = publisher; + Name = name; + Product = product; + PromotionCode = promotionCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publisher ID. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the plan ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the product of the image from the + /// marketplace. This is the same value as Offer under the + /// imageReference element. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets the Offer Promotion Code. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Product"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RecommendedMachineConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RecommendedMachineConfiguration.cs new file mode 100644 index 000000000000..c4d67275d998 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RecommendedMachineConfiguration.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties describe the recommended machine configuration for this + /// Image Definition. These properties are updatable. + /// + public partial class RecommendedMachineConfiguration + { + /// + /// Initializes a new instance of the RecommendedMachineConfiguration + /// class. + /// + public RecommendedMachineConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedMachineConfiguration + /// class. + /// + public RecommendedMachineConfiguration(ResourceRange vCPUs = default(ResourceRange), ResourceRange memory = default(ResourceRange)) + { + VCPUs = vCPUs; + Memory = memory; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "vCPUs")] + public ResourceRange VCPUs { get; set; } + + /// + /// + [JsonProperty(PropertyName = "memory")] + public ResourceRange Memory { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RecoveryWalkResponse.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RecoveryWalkResponse.cs new file mode 100644 index 000000000000..f72a34d7fe44 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RecoveryWalkResponse.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response after calling a manual recovery walk + /// + public partial class RecoveryWalkResponse + { + /// + /// Initializes a new instance of the RecoveryWalkResponse class. + /// + public RecoveryWalkResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecoveryWalkResponse class. + /// + /// Whether the recovery walk was + /// performed + /// The next update domain that + /// needs to be walked. Null means walk spanning all update domains has + /// been completed + public RecoveryWalkResponse(bool? walkPerformed = default(bool?), int? nextPlatformUpdateDomain = default(int?)) + { + WalkPerformed = walkPerformed; + NextPlatformUpdateDomain = nextPlatformUpdateDomain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets whether the recovery walk was performed + /// + [JsonProperty(PropertyName = "walkPerformed")] + public bool? WalkPerformed { get; private set; } + + /// + /// Gets the next update domain that needs to be walked. Null means + /// walk spanning all update domains has been completed + /// + [JsonProperty(PropertyName = "nextPlatformUpdateDomain")] + public int? NextPlatformUpdateDomain { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalReplicationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalReplicationStatus.cs new file mode 100644 index 000000000000..a40af552a406 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalReplicationStatus.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the regional replication status. + /// + public partial class RegionalReplicationStatus + { + /// + /// Initializes a new instance of the RegionalReplicationStatus class. + /// + public RegionalReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegionalReplicationStatus class. + /// + /// The region to which the gallery image version + /// is being replicated to. + /// This is the regional replication state. + /// Possible values include: 'Unknown', 'Replicating', 'Completed', + /// 'Failed' + /// The details of the replication + /// status. + /// It indicates progress of the replication + /// job. + public RegionalReplicationStatus(string region = default(string), string state = default(string), string details = default(string), int? progress = default(int?)) + { + Region = region; + State = state; + Details = details; + Progress = progress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the region to which the gallery image version is being + /// replicated to. + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; private set; } + + /// + /// Gets this is the regional replication state. Possible values + /// include: 'Unknown', 'Replicating', 'Completed', 'Failed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + /// + /// Gets the details of the replication status. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; private set; } + + /// + /// Gets it indicates progress of the replication job. + /// + [JsonProperty(PropertyName = "progress")] + public int? Progress { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalSharingStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalSharingStatus.cs new file mode 100644 index 000000000000..327b54618d95 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RegionalSharingStatus.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gallery regional sharing status + /// + public partial class RegionalSharingStatus + { + /// + /// Initializes a new instance of the RegionalSharingStatus class. + /// + public RegionalSharingStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegionalSharingStatus class. + /// + /// Region name + /// Gallery sharing state in current region. + /// Possible values include: 'Succeeded', 'InProgress', 'Failed', + /// 'Unknown' + /// Details of gallery regional sharing + /// failure. + public RegionalSharingStatus(string region = default(string), string state = default(string), string details = default(string)) + { + Region = region; + State = state; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets region name + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; set; } + + /// + /// Gets or sets gallery sharing state in current region. Possible + /// values include: 'Succeeded', 'InProgress', 'Failed', 'Unknown' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets details of gallery regional sharing failure. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RepairAction.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RepairAction.cs new file mode 100644 index 000000000000..93036df29aa9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RepairAction.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for RepairAction. + /// + public static class RepairAction + { + public const string Replace = "Replace"; + public const string Restart = "Restart"; + public const string Reimage = "Reimage"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationMode.cs new file mode 100644 index 000000000000..dda2287ee863 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ReplicationMode. + /// + public static class ReplicationMode + { + public const string Full = "Full"; + public const string Shallow = "Shallow"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationState.cs new file mode 100644 index 000000000000..f7fc0b93a288 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ReplicationState. + /// + public static class ReplicationState + { + public const string Unknown = "Unknown"; + public const string Replicating = "Replicating"; + public const string Completed = "Completed"; + public const string Failed = "Failed"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatus.cs new file mode 100644 index 000000000000..5263ab577613 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatus.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This is the replication status of the gallery image version. + /// + public partial class ReplicationStatus + { + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + public ReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + /// This is the aggregated replication + /// status based on all the regional replication status flags. Possible + /// values include: 'Unknown', 'InProgress', 'Completed', + /// 'Failed' + /// This is a summary of replication status for + /// each region. + public ReplicationStatus(string aggregatedState = default(string), IList summary = default(IList)) + { + AggregatedState = aggregatedState; + Summary = summary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this is the aggregated replication status based on all the + /// regional replication status flags. Possible values include: + /// 'Unknown', 'InProgress', 'Completed', 'Failed' + /// + [JsonProperty(PropertyName = "aggregatedState")] + public string AggregatedState { get; private set; } + + /// + /// Gets this is a summary of replication status for each region. + /// + [JsonProperty(PropertyName = "summary")] + public IList Summary { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatusTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatusTypes.cs new file mode 100644 index 000000000000..5fc58962ffa1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ReplicationStatusTypes.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for ReplicationStatusTypes. + /// + public static class ReplicationStatusTypes + { + public const string ReplicationStatus = "ReplicationStatus"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RequestRateByIntervalInput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RequestRateByIntervalInput.cs new file mode 100644 index 000000000000..a8fe7e5d4b1c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RequestRateByIntervalInput.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Api request input for LogAnalytics getRequestRateByInterval Api. + /// + public partial class RequestRateByIntervalInput : LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the RequestRateByIntervalInput class. + /// + public RequestRateByIntervalInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestRateByIntervalInput class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Interval value in minutes used to + /// create LogAnalytics call rate logs. Possible values include: + /// 'ThreeMins', 'FiveMins', 'ThirtyMins', 'SixtyMins' + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// Name. + /// Group query result by Resource + /// Name. + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public RequestRateByIntervalInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, IntervalInMins intervalLength, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) + : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent) + { + IntervalLength = intervalLength; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets interval value in minutes used to create LogAnalytics + /// call rate logs. Possible values include: 'ThreeMins', 'FiveMins', + /// 'ThirtyMins', 'SixtyMins' + /// + [JsonProperty(PropertyName = "intervalLength")] + public IntervalInMins IntervalLength { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Resource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..ec2892fb8f54 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceIdentityType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..fe0d168fb4cb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned, + [EnumMember(Value = "UserAssigned")] + UserAssigned, + [EnumMember(Value = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + [EnumMember(Value = "None")] + None + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; + case ResourceIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned, UserAssigned"; + case ResourceIdentityType.None: + return "None"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; + case "SystemAssigned, UserAssigned": + return ResourceIdentityType.SystemAssignedUserAssigned; + case "None": + return ResourceIdentityType.None; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceInstanceViewStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceInstanceViewStatus.cs new file mode 100644 index 000000000000..fd6a5d166a6a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceInstanceViewStatus.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Instance view status. + /// + public partial class ResourceInstanceViewStatus + { + /// + /// Initializes a new instance of the ResourceInstanceViewStatus class. + /// + public ResourceInstanceViewStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceInstanceViewStatus class. + /// + /// The status code. + /// The short localizable label for the + /// status. + /// The detailed status message, including for + /// alerts and error messages. + /// The time of the status. + /// The level code. Possible values include: + /// 'Info', 'Warning', 'Error' + public ResourceInstanceViewStatus(string code = default(string), string displayStatus = default(string), string message = default(string), System.DateTime? time = default(System.DateTime?), StatusLevelTypes? level = default(StatusLevelTypes?)) + { + Code = code; + DisplayStatus = displayStatus; + Message = message; + Time = time; + Level = level; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the short localizable label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; private set; } + + /// + /// Gets the detailed status message, including for alerts and error + /// messages. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the time of the status. + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; private set; } + + /// + /// Gets or sets the level code. Possible values include: 'Info', + /// 'Warning', 'Error' + /// + [JsonProperty(PropertyName = "level")] + public StatusLevelTypes? Level { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceRange.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceRange.cs new file mode 100644 index 000000000000..e5a444752082 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceRange.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the resource range. + /// + public partial class ResourceRange + { + /// + /// Initializes a new instance of the ResourceRange class. + /// + public ResourceRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceRange class. + /// + /// The minimum number of the resource. + /// The maximum number of the resource. + public ResourceRange(int? min = default(int?), int? max = default(int?)) + { + Min = min; + Max = max; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum number of the resource. + /// + [JsonProperty(PropertyName = "min")] + public int? Min { get; set; } + + /// + /// Gets or sets the maximum number of the resource. + /// + [JsonProperty(PropertyName = "max")] + public int? Max { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..c643ae3728b2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSku.cs @@ -0,0 +1,165 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes an available Compute SKU. + /// + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + /// The type of resource the SKU applies + /// to. + /// The name of SKU. + /// Specifies the tier of virtual machines in a + /// scale set.<br /><br /> Possible Values:<br + /// /><br /> **Standard**<br /><br /> + /// **Basic** + /// The Size of the SKU. + /// The Family of this particular SKU. + /// The Kind of resources that are supported in this + /// SKU. + /// Specifies the number of virtual machines in + /// the scale set. + /// The set of locations that the SKU is + /// available. + /// A list of locations and availability + /// zones in those locations where the SKU is available. + /// The api versions that support this + /// SKU. + /// Metadata for retrieving price info. + /// A name value pair to describe the + /// capability. + /// The restrictions because of which SKU + /// cannot be used. This is empty if there are no restrictions. + public ResourceSku(string resourceType = default(string), string name = default(string), string tier = default(string), string size = default(string), string family = default(string), string kind = default(string), ResourceSkuCapacity capacity = default(ResourceSkuCapacity), IList locations = default(IList), IList locationInfo = default(IList), IList apiVersions = default(IList), IList costs = default(IList), IList capabilities = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Size = size; + Family = family; + Kind = kind; + Capacity = capacity; + Locations = locations; + LocationInfo = locationInfo; + ApiVersions = apiVersions; + Costs = costs; + Capabilities = capabilities; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the SKU applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the name of SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets specifies the tier of virtual machines in a scale + /// set.&lt;br /&gt;&lt;br /&gt; Possible + /// Values:&lt;br /&gt;&lt;br /&gt; + /// **Standard**&lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// Gets the Size of the SKU. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; private set; } + + /// + /// Gets the Family of this particular SKU. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// Gets the Kind of resources that are supported in this SKU. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets specifies the number of virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "capacity")] + public ResourceSkuCapacity Capacity { get; private set; } + + /// + /// Gets the set of locations that the SKU is available. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets a list of locations and availability zones in those locations + /// where the SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; private set; } + + /// + /// Gets the api versions that support this SKU. + /// + [JsonProperty(PropertyName = "apiVersions")] + public IList ApiVersions { get; private set; } + + /// + /// Gets metadata for retrieving price info. + /// + [JsonProperty(PropertyName = "costs")] + public IList Costs { get; private set; } + + /// + /// Gets a name value pair to describe the capability. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets the restrictions because of which SKU cannot be used. This is + /// empty if there are no restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapabilities.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapabilities.cs new file mode 100644 index 000000000000..272bb901e726 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapabilities.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes The SKU capabilities object. + /// + public partial class ResourceSkuCapabilities + { + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + public ResourceSkuCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + /// An invariant to describe the feature. + /// An invariant if the feature is measured by + /// quantity. + public ResourceSkuCapabilities(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets an invariant to describe the feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets an invariant if the feature is measured by quantity. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacity.cs new file mode 100644 index 000000000000..7ff7b7d0c818 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacity.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes scaling information of a SKU. + /// + public partial class ResourceSkuCapacity + { + /// + /// Initializes a new instance of the ResourceSkuCapacity class. + /// + public ResourceSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCapacity class. + /// + /// The minimum capacity. + /// The maximum capacity that can be set. + /// The default capacity. + /// The scale type applicable to the sku. + /// Possible values include: 'Automatic', 'Manual', 'None' + public ResourceSkuCapacity(long? minimum = default(long?), long? maximum = default(long?), long? defaultProperty = default(long?), ResourceSkuCapacityScaleType? scaleType = default(ResourceSkuCapacityScaleType?)) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the minimum capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public long? Minimum { get; private set; } + + /// + /// Gets the maximum capacity that can be set. + /// + [JsonProperty(PropertyName = "maximum")] + public long? Maximum { get; private set; } + + /// + /// Gets the default capacity. + /// + [JsonProperty(PropertyName = "default")] + public long? DefaultProperty { get; private set; } + + /// + /// Gets the scale type applicable to the sku. Possible values include: + /// 'Automatic', 'Manual', 'None' + /// + [JsonProperty(PropertyName = "scaleType")] + public ResourceSkuCapacityScaleType? ScaleType { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacityScaleType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacityScaleType.cs new file mode 100644 index 000000000000..cf50ce88d490 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCapacityScaleType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuCapacityScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuCapacityScaleType + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "None")] + None + } + internal static class ResourceSkuCapacityScaleTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuCapacityScaleType? value) + { + return value == null ? null : ((ResourceSkuCapacityScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuCapacityScaleType value) + { + switch( value ) + { + case ResourceSkuCapacityScaleType.Automatic: + return "Automatic"; + case ResourceSkuCapacityScaleType.Manual: + return "Manual"; + case ResourceSkuCapacityScaleType.None: + return "None"; + } + return null; + } + + internal static ResourceSkuCapacityScaleType? ParseResourceSkuCapacityScaleType(this string value) + { + switch( value ) + { + case "Automatic": + return ResourceSkuCapacityScaleType.Automatic; + case "Manual": + return ResourceSkuCapacityScaleType.Manual; + case "None": + return ResourceSkuCapacityScaleType.None; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCosts.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCosts.cs new file mode 100644 index 000000000000..6c0cbaaacedd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuCosts.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes metadata for retrieving price info. + /// + public partial class ResourceSkuCosts + { + /// + /// Initializes a new instance of the ResourceSkuCosts class. + /// + public ResourceSkuCosts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCosts class. + /// + /// Used for querying price from + /// commerce. + /// The multiplier is needed to extend the base + /// metered cost. + /// An invariant to show the extended + /// unit. + public ResourceSkuCosts(string meterID = default(string), long? quantity = default(long?), string extendedUnit = default(string)) + { + MeterID = meterID; + Quantity = quantity; + ExtendedUnit = extendedUnit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets used for querying price from commerce. + /// + [JsonProperty(PropertyName = "meterID")] + public string MeterID { get; private set; } + + /// + /// Gets the multiplier is needed to extend the base metered cost. + /// + [JsonProperty(PropertyName = "quantity")] + public long? Quantity { get; private set; } + + /// + /// Gets an invariant to show the extended unit. + /// + [JsonProperty(PropertyName = "extendedUnit")] + public string ExtendedUnit { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuLocationInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuLocationInfo.cs new file mode 100644 index 000000000000..827efc95d4ed --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuLocationInfo.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes an available Compute SKU Location Information. + /// + public partial class ResourceSkuLocationInfo + { + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + public ResourceSkuLocationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + /// Location of the SKU + /// List of availability zones where the SKU is + /// supported. + /// Details of capabilities available to a + /// SKU in specific zones. + /// The names of extended + /// locations. + /// The type of the extended location. Possible + /// values include: 'EdgeZone' + public ResourceSkuLocationInfo(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList), IList extendedLocations = default(IList), string type = default(string)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + ExtendedLocations = extendedLocations; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the SKU + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets list of availability zones where the SKU is supported. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Gets details of capabilities available to a SKU in specific zones. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; private set; } + + /// + /// Gets the names of extended locations. + /// + [JsonProperty(PropertyName = "extendedLocations")] + public IList ExtendedLocations { get; private set; } + + /// + /// Gets the type of the extended location. Possible values include: + /// 'EdgeZone' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionInfo.cs new file mode 100644 index 000000000000..a0fc83459405 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionInfo.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes an available Compute SKU Restriction Information. + /// + public partial class ResourceSkuRestrictionInfo + { + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + public ResourceSkuRestrictionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + /// Locations where the SKU is + /// restricted + /// List of availability zones where the SKU is + /// restricted. + public ResourceSkuRestrictionInfo(IList locations = default(IList), IList zones = default(IList)) + { + Locations = locations; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets locations where the SKU is restricted + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets list of availability zones where the SKU is restricted. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictions.cs new file mode 100644 index 000000000000..46a7fb12e40d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes scaling information of a SKU. + /// + public partial class ResourceSkuRestrictions + { + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + public ResourceSkuRestrictions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + /// The type of restrictions. Possible values + /// include: 'Location', 'Zone' + /// The value of restrictions. If the restriction + /// type is set to location. This would be different locations where + /// the SKU is restricted. + /// The information about the restriction + /// where the SKU cannot be used. + /// The reason for restriction. Possible + /// values include: 'QuotaId', 'NotAvailableForSubscription' + public ResourceSkuRestrictions(ResourceSkuRestrictionsType? type = default(ResourceSkuRestrictionsType?), IList values = default(IList), ResourceSkuRestrictionInfo restrictionInfo = default(ResourceSkuRestrictionInfo), ResourceSkuRestrictionsReasonCode? reasonCode = default(ResourceSkuRestrictionsReasonCode?)) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restrictions. Possible values include: 'Location', + /// 'Zone' + /// + [JsonProperty(PropertyName = "type")] + public ResourceSkuRestrictionsType? Type { get; private set; } + + /// + /// Gets the value of restrictions. If the restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; private set; } + + /// + /// Gets the information about the restriction where the SKU cannot be + /// used. + /// + [JsonProperty(PropertyName = "restrictionInfo")] + public ResourceSkuRestrictionInfo RestrictionInfo { get; private set; } + + /// + /// Gets the reason for restriction. Possible values include: + /// 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public ResourceSkuRestrictionsReasonCode? ReasonCode { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsReasonCode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsReasonCode.cs new file mode 100644 index 000000000000..2cf4b4bc828f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsReasonCode.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuRestrictionsReasonCode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuRestrictionsReasonCode + { + [EnumMember(Value = "QuotaId")] + QuotaId, + [EnumMember(Value = "NotAvailableForSubscription")] + NotAvailableForSubscription + } + internal static class ResourceSkuRestrictionsReasonCodeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuRestrictionsReasonCode? value) + { + return value == null ? null : ((ResourceSkuRestrictionsReasonCode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuRestrictionsReasonCode value) + { + switch( value ) + { + case ResourceSkuRestrictionsReasonCode.QuotaId: + return "QuotaId"; + case ResourceSkuRestrictionsReasonCode.NotAvailableForSubscription: + return "NotAvailableForSubscription"; + } + return null; + } + + internal static ResourceSkuRestrictionsReasonCode? ParseResourceSkuRestrictionsReasonCode(this string value) + { + switch( value ) + { + case "QuotaId": + return ResourceSkuRestrictionsReasonCode.QuotaId; + case "NotAvailableForSubscription": + return ResourceSkuRestrictionsReasonCode.NotAvailableForSubscription; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsType.cs new file mode 100644 index 000000000000..220256fb869d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuRestrictionsType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceSkuRestrictionsType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceSkuRestrictionsType + { + [EnumMember(Value = "Location")] + Location, + [EnumMember(Value = "Zone")] + Zone + } + internal static class ResourceSkuRestrictionsTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceSkuRestrictionsType? value) + { + return value == null ? null : ((ResourceSkuRestrictionsType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceSkuRestrictionsType value) + { + switch( value ) + { + case ResourceSkuRestrictionsType.Location: + return "Location"; + case ResourceSkuRestrictionsType.Zone: + return "Zone"; + } + return null; + } + + internal static ResourceSkuRestrictionsType? ParseResourceSkuRestrictionsType(this string value) + { + switch( value ) + { + case "Location": + return ResourceSkuRestrictionsType.Location; + case "Zone": + return ResourceSkuRestrictionsType.Zone; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuZoneDetails.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuZoneDetails.cs new file mode 100644 index 000000000000..fa0077964171 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceSkuZoneDetails.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes The zonal capabilities of a SKU. + /// + public partial class ResourceSkuZoneDetails + { + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + public ResourceSkuZoneDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + /// The set of zones that the SKU is available in + /// with the specified capabilities. + /// A list of capabilities that are + /// available for the SKU in the specified list of zones. + public ResourceSkuZoneDetails(IList name = default(IList), IList capabilities = default(IList)) + { + Name = name; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of zones that the SKU is available in with the + /// specified capabilities. + /// + [JsonProperty(PropertyName = "name")] + public IList Name { get; private set; } + + /// + /// Gets a list of capabilities that are available for the SKU in the + /// specified list of zones. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceWithOptionalLocation.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceWithOptionalLocation.cs new file mode 100644 index 000000000000..3a438c04f455 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ResourceWithOptionalLocation.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition with location property as optional. + /// + public partial class ResourceWithOptionalLocation : IResource + { + /// + /// Initializes a new instance of the ResourceWithOptionalLocation + /// class. + /// + public ResourceWithOptionalLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceWithOptionalLocation + /// class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + public ResourceWithOptionalLocation(string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Location = location; + Id = id; + Name = name; + Type = type; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePoint.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePoint.cs new file mode 100644 index 000000000000..a4fc424acfa5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePoint.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Restore Point details. + /// + [Rest.Serialization.JsonTransformation] + public partial class RestorePoint : ProxyResource + { + /// + /// Initializes a new instance of the RestorePoint class. + /// + public RestorePoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePoint class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// List of disk resource ids that the + /// customer wishes to exclude from the restore point. If no disks are + /// specified, all disks will be included. + /// Gets the details of the VM captured at + /// the time of the restore point creation. + /// Gets the provisioning state of the + /// restore point. + /// ConsistencyMode of the RestorePoint. + /// Can be specified in the input while creating a restore point. For + /// now, only CrashConsistent is accepted as a valid input. Please + /// refer to https://aka.ms/RestorePoints for more details. Possible + /// values include: 'CrashConsistent', 'FileSystemConsistent', + /// 'ApplicationConsistent' + /// Gets the creation time of the restore + /// point. + /// Resource Id of the source restore + /// point from which a copy needs to be created. + /// The restore point instance view. + public RestorePoint(string id = default(string), string name = default(string), string type = default(string), IList excludeDisks = default(IList), RestorePointSourceMetadata sourceMetadata = default(RestorePointSourceMetadata), string provisioningState = default(string), string consistencyMode = default(string), System.DateTime? timeCreated = default(System.DateTime?), ApiEntityReference sourceRestorePoint = default(ApiEntityReference), RestorePointInstanceView instanceView = default(RestorePointInstanceView)) + : base(id, name, type) + { + ExcludeDisks = excludeDisks; + SourceMetadata = sourceMetadata; + ProvisioningState = provisioningState; + ConsistencyMode = consistencyMode; + TimeCreated = timeCreated; + SourceRestorePoint = sourceRestorePoint; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of disk resource ids that the customer wishes to + /// exclude from the restore point. If no disks are specified, all + /// disks will be included. + /// + [JsonProperty(PropertyName = "properties.excludeDisks")] + public IList ExcludeDisks { get; set; } + + /// + /// Gets the details of the VM captured at the time of the restore + /// point creation. + /// + [JsonProperty(PropertyName = "properties.sourceMetadata")] + public RestorePointSourceMetadata SourceMetadata { get; set; } + + /// + /// Gets the provisioning state of the restore point. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets consistencyMode of the RestorePoint. Can be specified + /// in the input while creating a restore point. For now, only + /// CrashConsistent is accepted as a valid input. Please refer to + /// https://aka.ms/RestorePoints for more details. Possible values + /// include: 'CrashConsistent', 'FileSystemConsistent', + /// 'ApplicationConsistent' + /// + [JsonProperty(PropertyName = "properties.consistencyMode")] + public string ConsistencyMode { get; set; } + + /// + /// Gets the creation time of the restore point. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; set; } + + /// + /// Gets or sets resource Id of the source restore point from which a + /// copy needs to be created. + /// + [JsonProperty(PropertyName = "properties.sourceRestorePoint")] + public ApiEntityReference SourceRestorePoint { get; set; } + + /// + /// Gets the restore point instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public RestorePointInstanceView InstanceView { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceMetadata != null) + { + SourceMetadata.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollection.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollection.cs new file mode 100644 index 000000000000..5a744737cb4e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollection.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Create or update Restore Point collection parameters. + /// + [Rest.Serialization.JsonTransformation] + public partial class RestorePointCollection : Resource + { + /// + /// Initializes a new instance of the RestorePointCollection class. + /// + public RestorePointCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointCollection class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The provisioning state of the + /// restore point collection. + /// The unique id of the restore + /// point collection. + /// A list containing all restore points + /// created under this restore point collection. + public RestorePointCollection(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), RestorePointCollectionSourceProperties source = default(RestorePointCollectionSourceProperties), string provisioningState = default(string), string restorePointCollectionId = default(string), IList restorePoints = default(IList)) + : base(location, id, name, type, tags) + { + Source = source; + ProvisioningState = provisioningState; + RestorePointCollectionId = restorePointCollectionId; + RestorePoints = restorePoints; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.source")] + public RestorePointCollectionSourceProperties Source { get; set; } + + /// + /// Gets the provisioning state of the restore point collection. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique id of the restore point collection. + /// + [JsonProperty(PropertyName = "properties.restorePointCollectionId")] + public string RestorePointCollectionId { get; private set; } + + /// + /// Gets a list containing all restore points created under this + /// restore point collection. + /// + [JsonProperty(PropertyName = "properties.restorePoints")] + public IList RestorePoints { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (RestorePoints != null) + { + foreach (var element in RestorePoints) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionExpandOptions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionExpandOptions.cs new file mode 100644 index 000000000000..aa68d83154f1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionExpandOptions.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for RestorePointCollectionExpandOptions. + /// + public static class RestorePointCollectionExpandOptions + { + public const string RestorePoints = "restorePoints"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionSourceProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionSourceProperties.cs new file mode 100644 index 000000000000..5d860ae3909e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionSourceProperties.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the source resource that this restore point + /// collection is created from. + /// + public partial class RestorePointCollectionSourceProperties + { + /// + /// Initializes a new instance of the + /// RestorePointCollectionSourceProperties class. + /// + public RestorePointCollectionSourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RestorePointCollectionSourceProperties class. + /// + /// Location of the source resource used to + /// create this restore point collection. + /// Resource Id of the source resource used to create + /// this restore point collection + public RestorePointCollectionSourceProperties(string location = default(string), string id = default(string)) + { + Location = location; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the source resource used to create this restore + /// point collection. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets or sets resource Id of the source resource used to create this + /// restore point collection + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionUpdate.cs new file mode 100644 index 000000000000..ee169d5de96c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointCollectionUpdate.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Update Restore Point collection parameters. + /// + [Rest.Serialization.JsonTransformation] + public partial class RestorePointCollectionUpdate : UpdateResource + { + /// + /// Initializes a new instance of the RestorePointCollectionUpdate + /// class. + /// + public RestorePointCollectionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointCollectionUpdate + /// class. + /// + /// Resource tags + /// The provisioning state of the + /// restore point collection. + /// The unique id of the restore + /// point collection. + /// A list containing all restore points + /// created under this restore point collection. + public RestorePointCollectionUpdate(IDictionary tags = default(IDictionary), RestorePointCollectionSourceProperties source = default(RestorePointCollectionSourceProperties), string provisioningState = default(string), string restorePointCollectionId = default(string), IList restorePoints = default(IList)) + : base(tags) + { + Source = source; + ProvisioningState = provisioningState; + RestorePointCollectionId = restorePointCollectionId; + RestorePoints = restorePoints; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.source")] + public RestorePointCollectionSourceProperties Source { get; set; } + + /// + /// Gets the provisioning state of the restore point collection. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the unique id of the restore point collection. + /// + [JsonProperty(PropertyName = "properties.restorePointCollectionId")] + public string RestorePointCollectionId { get; private set; } + + /// + /// Gets a list containing all restore points created under this + /// restore point collection. + /// + [JsonProperty(PropertyName = "properties.restorePoints")] + public IList RestorePoints { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryption.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryption.cs new file mode 100644 index 000000000000..5abf9cd71571 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryption.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Encryption at rest settings for disk restore point. It is an optional + /// property that can be specified in the input while creating a restore + /// point. + /// + public partial class RestorePointEncryption + { + /// + /// Initializes a new instance of the RestorePointEncryption class. + /// + public RestorePointEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointEncryption class. + /// + /// Possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + public RestorePointEncryption(DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters), string type = default(string)) + { + DiskEncryptionSet = diskEncryptionSet; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + /// + /// Gets or sets possible values include: + /// 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey', + /// 'EncryptionAtRestWithPlatformAndCustomerKeys' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryptionType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryptionType.cs new file mode 100644 index 000000000000..13ed761303b9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointEncryptionType.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for RestorePointEncryptionType. + /// + public static class RestorePointEncryptionType + { + /// + /// Disk Restore Point is encrypted at rest with Platform managed key. + /// + public const string EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey"; + /// + /// Disk Restore Point is encrypted at rest with Customer managed key + /// that can be changed and revoked by a customer. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + /// + /// Disk Restore Point is encrypted at rest with 2 layers of + /// encryption. One of the keys is Customer managed and the other key + /// is Platform managed. + /// + public const string EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointExpandOptions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointExpandOptions.cs new file mode 100644 index 000000000000..8c9c16f10b61 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointExpandOptions.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for RestorePointExpandOptions. + /// + public static class RestorePointExpandOptions + { + public const string InstanceView = "instanceView"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointInstanceView.cs new file mode 100644 index 000000000000..9e1bfde85d71 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointInstanceView.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a restore point. + /// + public partial class RestorePointInstanceView + { + /// + /// Initializes a new instance of the RestorePointInstanceView class. + /// + public RestorePointInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointInstanceView class. + /// + /// The disk restore points + /// information. + /// The resource status information. + public RestorePointInstanceView(IList diskRestorePoints = default(IList), IList statuses = default(IList)) + { + DiskRestorePoints = diskRestorePoints; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk restore points information. + /// + [JsonProperty(PropertyName = "diskRestorePoints")] + public IList DiskRestorePoints { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceMetadata.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceMetadata.cs new file mode 100644 index 000000000000..66ed71d72f80 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceMetadata.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of the Virtual Machine for which the restore + /// point was created. The properties provided are a subset and the + /// snapshot of the overall Virtual Machine properties captured at the time + /// of the restore point creation. + /// + public partial class RestorePointSourceMetadata + { + /// + /// Initializes a new instance of the RestorePointSourceMetadata class. + /// + public RestorePointSourceMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointSourceMetadata class. + /// + /// Gets the hardware profile. + /// Gets the storage profile. + /// Gets the OS profile. + /// Gets the diagnostics + /// profile. + /// Gets the license type, which is for bring + /// your own license scenario. + /// Gets the virtual machine unique id. + /// Gets the security profile. + /// Location of the VM from which the restore + /// point was created. + /// UserData associated with the source VM for + /// which restore point is captured, which is a base-64 encoded + /// value. + /// HyperVGeneration of the source VM + /// for which restore point is captured. Possible values include: 'V1', + /// 'V2' + public RestorePointSourceMetadata(HardwareProfile hardwareProfile = default(HardwareProfile), RestorePointSourceVMStorageProfile storageProfile = default(RestorePointSourceVMStorageProfile), OSProfile osProfile = default(OSProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), string licenseType = default(string), string vmId = default(string), SecurityProfile securityProfile = default(SecurityProfile), string location = default(string), string userData = default(string), string hyperVGeneration = default(string)) + { + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + OsProfile = osProfile; + DiagnosticsProfile = diagnosticsProfile; + LicenseType = licenseType; + VmId = vmId; + SecurityProfile = securityProfile; + Location = location; + UserData = userData; + HyperVGeneration = hyperVGeneration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the hardware profile. + /// + [JsonProperty(PropertyName = "hardwareProfile")] + public HardwareProfile HardwareProfile { get; private set; } + + /// + /// Gets the storage profile. + /// + [JsonProperty(PropertyName = "storageProfile")] + public RestorePointSourceVMStorageProfile StorageProfile { get; set; } + + /// + /// Gets the OS profile. + /// + [JsonProperty(PropertyName = "osProfile")] + public OSProfile OsProfile { get; private set; } + + /// + /// Gets the diagnostics profile. + /// + [JsonProperty(PropertyName = "diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; private set; } + + /// + /// Gets the license type, which is for bring your own license + /// scenario. + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; private set; } + + /// + /// Gets the virtual machine unique id. + /// + [JsonProperty(PropertyName = "vmId")] + public string VmId { get; private set; } + + /// + /// Gets the security profile. + /// + [JsonProperty(PropertyName = "securityProfile")] + public SecurityProfile SecurityProfile { get; private set; } + + /// + /// Gets location of the VM from which the restore point was created. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets userData associated with the source VM for which restore point + /// is captured, which is a base-64 encoded value. + /// + [JsonProperty(PropertyName = "userData")] + public string UserData { get; private set; } + + /// + /// Gets hyperVGeneration of the source VM for which restore point is + /// captured. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "hyperVGeneration")] + public string HyperVGeneration { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMDataDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMDataDisk.cs new file mode 100644 index 000000000000..b2f21608e2bc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMDataDisk.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a data disk. + /// + public partial class RestorePointSourceVMDataDisk + { + /// + /// Initializes a new instance of the RestorePointSourceVMDataDisk + /// class. + /// + public RestorePointSourceVMDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointSourceVMDataDisk + /// class. + /// + /// Gets the logical unit number. + /// Gets the disk name. + /// Gets the caching type. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + /// Gets the initial disk size in GB for blank + /// data disks, and the new desired size for existing OS and Data + /// disks. + /// Contains the managed disk + /// details. + /// Contains Disk Restore Point + /// properties. + /// Shows true if the disk is + /// write-accelerator enabled. + public RestorePointSourceVMDataDisk(int? lun = default(int?), string name = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), DiskRestorePointAttributes diskRestorePoint = default(DiskRestorePointAttributes), bool? writeAcceleratorEnabled = default(bool?)) + { + Lun = lun; + Name = name; + Caching = caching; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + DiskRestorePoint = diskRestorePoint; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the logical unit number. + /// + [JsonProperty(PropertyName = "lun")] + public int? Lun { get; private set; } + + /// + /// Gets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the caching type. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; private set; } + + /// + /// Gets the initial disk size in GB for blank data disks, and the new + /// desired size for existing OS and Data disks. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; private set; } + + /// + /// Gets or sets contains the managed disk details. + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets contains Disk Restore Point properties. + /// + [JsonProperty(PropertyName = "diskRestorePoint")] + public DiskRestorePointAttributes DiskRestorePoint { get; set; } + + /// + /// Gets shows true if the disk is write-accelerator enabled. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMOSDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMOSDisk.cs new file mode 100644 index 000000000000..b14482fec10f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMOSDisk.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Operating System disk. + /// + public partial class RestorePointSourceVMOSDisk + { + /// + /// Initializes a new instance of the RestorePointSourceVMOSDisk class. + /// + public RestorePointSourceVMOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointSourceVMOSDisk class. + /// + /// Gets the Operating System type. Possible + /// values include: 'Windows', 'Linux' + /// Gets the disk encryption + /// settings. + /// Gets the disk name. + /// Gets the caching type. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + /// Gets the disk size in GB. + /// Gets the managed disk details + /// Contains Disk Restore Point + /// properties. + /// Shows true if the disk is + /// write-accelerator enabled. + public RestorePointSourceVMOSDisk(string osType = default(string), DiskEncryptionSettings encryptionSettings = default(DiskEncryptionSettings), string name = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), DiskRestorePointAttributes diskRestorePoint = default(DiskRestorePointAttributes), bool? writeAcceleratorEnabled = default(bool?)) + { + OsType = osType; + EncryptionSettings = encryptionSettings; + Name = name; + Caching = caching; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + DiskRestorePoint = diskRestorePoint; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Operating System type. Possible values include: 'Windows', + /// 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; private set; } + + /// + /// Gets the disk encryption settings. + /// + [JsonProperty(PropertyName = "encryptionSettings")] + public DiskEncryptionSettings EncryptionSettings { get; private set; } + + /// + /// Gets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the caching type. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; private set; } + + /// + /// Gets the disk size in GB. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; private set; } + + /// + /// Gets the managed disk details + /// + [JsonProperty(PropertyName = "managedDisk")] + public ManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets contains Disk Restore Point properties. + /// + [JsonProperty(PropertyName = "diskRestorePoint")] + public DiskRestorePointAttributes DiskRestorePoint { get; set; } + + /// + /// Gets shows true if the disk is write-accelerator enabled. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettings != null) + { + EncryptionSettings.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMStorageProfile.cs new file mode 100644 index 000000000000..75de44eb9670 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RestorePointSourceVMStorageProfile.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the storage profile. + /// + public partial class RestorePointSourceVMStorageProfile + { + /// + /// Initializes a new instance of the + /// RestorePointSourceVMStorageProfile class. + /// + public RestorePointSourceVMStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RestorePointSourceVMStorageProfile class. + /// + /// Gets the OS disk of the VM captured at the + /// time of the restore point creation. + /// Gets the data disks of the VM captured at + /// the time of the restore point creation. + public RestorePointSourceVMStorageProfile(RestorePointSourceVMOSDisk osDisk = default(RestorePointSourceVMOSDisk), IList dataDisks = default(IList)) + { + OsDisk = osDisk; + DataDisks = dataDisks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the OS disk of the VM captured at the time of the restore + /// point creation. + /// + [JsonProperty(PropertyName = "osDisk")] + public RestorePointSourceVMOSDisk OsDisk { get; set; } + + /// + /// Gets the data disks of the VM captured at the time of the restore + /// point creation. + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RetrieveBootDiagnosticsDataResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RetrieveBootDiagnosticsDataResult.cs new file mode 100644 index 000000000000..2aa19f2cb654 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RetrieveBootDiagnosticsDataResult.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAS URIs of the console screenshot and serial log blobs. + /// + public partial class RetrieveBootDiagnosticsDataResult + { + /// + /// Initializes a new instance of the RetrieveBootDiagnosticsDataResult + /// class. + /// + public RetrieveBootDiagnosticsDataResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetrieveBootDiagnosticsDataResult + /// class. + /// + /// The console screenshot blob + /// URI + /// The serial console log blob + /// URI. + public RetrieveBootDiagnosticsDataResult(string consoleScreenshotBlobUri = default(string), string serialConsoleLogBlobUri = default(string)) + { + ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; + SerialConsoleLogBlobUri = serialConsoleLogBlobUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the console screenshot blob URI + /// + [JsonProperty(PropertyName = "consoleScreenshotBlobUri")] + public string ConsoleScreenshotBlobUri { get; private set; } + + /// + /// Gets the serial console log blob URI. + /// + [JsonProperty(PropertyName = "serialConsoleLogBlobUri")] + public string SerialConsoleLogBlobUri { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstance.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstance.cs new file mode 100644 index 000000000000..5dfa82612b32 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstance.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the cloud service role instance. + /// + public partial class RoleInstance + { + /// + /// Initializes a new instance of the RoleInstance class. + /// + public RoleInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstance class. + /// + /// Resource Id + /// Resource Name. + /// Resource Type. + /// Resource Location. + /// Resource tags. + public RoleInstance(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), InstanceSku sku = default(InstanceSku), RoleInstanceProperties properties = default(RoleInstanceProperties)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Sku = sku; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource Name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource Type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource Location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public InstanceSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public RoleInstanceProperties Properties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceInstanceView.cs new file mode 100644 index 000000000000..5897af48e493 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceInstanceView.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of the role instance. + /// + public partial class RoleInstanceInstanceView + { + /// + /// Initializes a new instance of the RoleInstanceInstanceView class. + /// + public RoleInstanceInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceInstanceView class. + /// + /// The Update Domain. + /// The Fault Domain. + /// Specifies a unique identifier generated + /// internally for the cloud service associated with this role + /// instance. <br /><br /> NOTE: If you are using Azure + /// Diagnostics extension, this property can be used as 'DeploymentId' + /// for querying details. + public RoleInstanceInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string privateId = default(string), IList statuses = default(IList)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + PrivateId = privateId; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Update Domain. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; private set; } + + /// + /// Gets the Fault Domain. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; private set; } + + /// + /// Gets specifies a unique identifier generated internally for the + /// cloud service associated with this role instance. &lt;br + /// /&gt;&lt;br /&gt; NOTE: If you are using Azure + /// Diagnostics extension, this property can be used as 'DeploymentId' + /// for querying details. + /// + [JsonProperty(PropertyName = "privateId")] + public string PrivateId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceNetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceNetworkProfile.cs new file mode 100644 index 000000000000..4a74b02f3610 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceNetworkProfile.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the network profile for the role instance. + /// + public partial class RoleInstanceNetworkProfile + { + /// + /// Initializes a new instance of the RoleInstanceNetworkProfile class. + /// + public RoleInstanceNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceNetworkProfile class. + /// + /// Specifies the list of resource Ids + /// for the network interfaces associated with the role + /// instance. + public RoleInstanceNetworkProfile(IList networkInterfaces = default(IList)) + { + NetworkInterfaces = networkInterfaces; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the list of resource Ids for the network interfaces + /// associated with the role instance. + /// + [JsonProperty(PropertyName = "networkInterfaces")] + public IList NetworkInterfaces { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceProperties.cs new file mode 100644 index 000000000000..0ec532edc2bc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstanceProperties.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Role instance properties. + /// + public partial class RoleInstanceProperties + { + /// + /// Initializes a new instance of the RoleInstanceProperties class. + /// + public RoleInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstanceProperties class. + /// + public RoleInstanceProperties(RoleInstanceNetworkProfile networkProfile = default(RoleInstanceNetworkProfile), RoleInstanceInstanceView instanceView = default(RoleInstanceInstanceView)) + { + NetworkProfile = networkProfile; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "networkProfile")] + public RoleInstanceNetworkProfile NetworkProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "instanceView")] + public RoleInstanceInstanceView InstanceView { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstances.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstances.cs new file mode 100644 index 000000000000..ca428016fc69 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RoleInstances.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a list of role instances from the cloud service. + /// + public partial class RoleInstances + { + /// + /// Initializes a new instance of the RoleInstances class. + /// + public RoleInstances() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleInstances class. + /// + /// List of cloud service role + /// instance names. Value of '*' will signify all role instances of the + /// cloud service. + public RoleInstances(IList roleInstancesProperty) + { + RoleInstancesProperty = roleInstancesProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of cloud service role instance names. Value of + /// '*' will signify all role instances of the cloud service. + /// + [JsonProperty(PropertyName = "roleInstances")] + public IList RoleInstancesProperty { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RoleInstancesProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RoleInstancesProperty"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollbackStatusInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollbackStatusInfo.cs new file mode 100644 index 000000000000..e68e9792dc38 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollbackStatusInfo.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about rollback on failed VM instances after a OS Upgrade + /// operation. + /// + public partial class RollbackStatusInfo + { + /// + /// Initializes a new instance of the RollbackStatusInfo class. + /// + public RollbackStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollbackStatusInfo class. + /// + /// The number of + /// instances which have been successfully rolled back. + /// The number of instances + /// which failed to rollback. + /// Error details if OS rollback + /// failed. + public RollbackStatusInfo(int? successfullyRolledbackInstanceCount = default(int?), int? failedRolledbackInstanceCount = default(int?), ApiError rollbackError = default(ApiError)) + { + SuccessfullyRolledbackInstanceCount = successfullyRolledbackInstanceCount; + FailedRolledbackInstanceCount = failedRolledbackInstanceCount; + RollbackError = rollbackError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the number of instances which have been successfully rolled + /// back. + /// + [JsonProperty(PropertyName = "successfullyRolledbackInstanceCount")] + public int? SuccessfullyRolledbackInstanceCount { get; private set; } + + /// + /// Gets the number of instances which failed to rollback. + /// + [JsonProperty(PropertyName = "failedRolledbackInstanceCount")] + public int? FailedRolledbackInstanceCount { get; private set; } + + /// + /// Gets error details if OS rollback failed. + /// + [JsonProperty(PropertyName = "rollbackError")] + public ApiError RollbackError { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeActionType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeActionType.cs new file mode 100644 index 000000000000..7e3c4f93c1c1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeActionType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RollingUpgradeActionType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RollingUpgradeActionType + { + [EnumMember(Value = "Start")] + Start, + [EnumMember(Value = "Cancel")] + Cancel + } + internal static class RollingUpgradeActionTypeEnumExtension + { + internal static string ToSerializedValue(this RollingUpgradeActionType? value) + { + return value == null ? null : ((RollingUpgradeActionType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RollingUpgradeActionType value) + { + switch( value ) + { + case RollingUpgradeActionType.Start: + return "Start"; + case RollingUpgradeActionType.Cancel: + return "Cancel"; + } + return null; + } + + internal static RollingUpgradeActionType? ParseRollingUpgradeActionType(this string value) + { + switch( value ) + { + case "Start": + return RollingUpgradeActionType.Start; + case "Cancel": + return RollingUpgradeActionType.Cancel; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradePolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradePolicy.cs new file mode 100644 index 000000000000..27466ed8dae7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradePolicy.cs @@ -0,0 +1,201 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The configuration parameters used while performing a rolling upgrade. + /// + public partial class RollingUpgradePolicy + { + /// + /// Initializes a new instance of the RollingUpgradePolicy class. + /// + public RollingUpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradePolicy class. + /// + /// The maximum percent of total + /// virtual machine instances that will be upgraded simultaneously by + /// the rolling upgrade in one batch. As this is a maximum, unhealthy + /// instances in previous or future batches can cause the percentage of + /// instances in a batch to decrease to ensure higher reliability. The + /// default value for this parameter is 20%. + /// The maximum percentage of + /// the total virtual machine instances in the scale set that can be + /// simultaneously unhealthy, either as a result of being upgraded, or + /// by being found in an unhealthy state by the virtual machine health + /// checks before the rolling upgrade aborts. This constraint will be + /// checked prior to starting any batch. The default value for this + /// parameter is 20%. + /// The maximum + /// percentage of upgraded virtual machine instances that can be found + /// to be in an unhealthy state. This check will happen after each + /// batch is upgraded. If this percentage is ever exceeded, the rolling + /// update aborts. The default value for this parameter is 20%. + /// The wait time between + /// completing the update for all virtual machines in one batch and + /// starting the next batch. The time duration should be specified in + /// ISO 8601 format. The default value is 0 seconds (PT0S). + /// Allow VMSS to ignore AZ + /// boundaries when constructing upgrade batches. Take into + /// consideration the Update Domain and maxBatchInstancePercent to + /// determine the batch size. + /// Upgrade all unhealthy + /// instances in a scale set before any healthy instances. + /// Rollback failed + /// instances to previous model if the Rolling Upgrade policy is + /// violated. + /// Create new virtual machines to upgrade the + /// scale set, rather than updating the existing virtual machines. + /// Existing virtual machines will be deleted once the new virtual + /// machines are created for each batch. + public RollingUpgradePolicy(int? maxBatchInstancePercent = default(int?), int? maxUnhealthyInstancePercent = default(int?), int? maxUnhealthyUpgradedInstancePercent = default(int?), string pauseTimeBetweenBatches = default(string), bool? enableCrossZoneUpgrade = default(bool?), bool? prioritizeUnhealthyInstances = default(bool?), bool? rollbackFailedInstancesOnPolicyBreach = default(bool?), bool? maxSurge = default(bool?)) + { + MaxBatchInstancePercent = maxBatchInstancePercent; + MaxUnhealthyInstancePercent = maxUnhealthyInstancePercent; + MaxUnhealthyUpgradedInstancePercent = maxUnhealthyUpgradedInstancePercent; + PauseTimeBetweenBatches = pauseTimeBetweenBatches; + EnableCrossZoneUpgrade = enableCrossZoneUpgrade; + PrioritizeUnhealthyInstances = prioritizeUnhealthyInstances; + RollbackFailedInstancesOnPolicyBreach = rollbackFailedInstancesOnPolicyBreach; + MaxSurge = maxSurge; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the maximum percent of total virtual machine instances + /// that will be upgraded simultaneously by the rolling upgrade in one + /// batch. As this is a maximum, unhealthy instances in previous or + /// future batches can cause the percentage of instances in a batch to + /// decrease to ensure higher reliability. The default value for this + /// parameter is 20%. + /// + [JsonProperty(PropertyName = "maxBatchInstancePercent")] + public int? MaxBatchInstancePercent { get; set; } + + /// + /// Gets or sets the maximum percentage of the total virtual machine + /// instances in the scale set that can be simultaneously unhealthy, + /// either as a result of being upgraded, or by being found in an + /// unhealthy state by the virtual machine health checks before the + /// rolling upgrade aborts. This constraint will be checked prior to + /// starting any batch. The default value for this parameter is 20%. + /// + [JsonProperty(PropertyName = "maxUnhealthyInstancePercent")] + public int? MaxUnhealthyInstancePercent { get; set; } + + /// + /// Gets or sets the maximum percentage of upgraded virtual machine + /// instances that can be found to be in an unhealthy state. This check + /// will happen after each batch is upgraded. If this percentage is + /// ever exceeded, the rolling update aborts. The default value for + /// this parameter is 20%. + /// + [JsonProperty(PropertyName = "maxUnhealthyUpgradedInstancePercent")] + public int? MaxUnhealthyUpgradedInstancePercent { get; set; } + + /// + /// Gets or sets the wait time between completing the update for all + /// virtual machines in one batch and starting the next batch. The time + /// duration should be specified in ISO 8601 format. The default value + /// is 0 seconds (PT0S). + /// + [JsonProperty(PropertyName = "pauseTimeBetweenBatches")] + public string PauseTimeBetweenBatches { get; set; } + + /// + /// Gets or sets allow VMSS to ignore AZ boundaries when constructing + /// upgrade batches. Take into consideration the Update Domain and + /// maxBatchInstancePercent to determine the batch size. + /// + [JsonProperty(PropertyName = "enableCrossZoneUpgrade")] + public bool? EnableCrossZoneUpgrade { get; set; } + + /// + /// Gets or sets upgrade all unhealthy instances in a scale set before + /// any healthy instances. + /// + [JsonProperty(PropertyName = "prioritizeUnhealthyInstances")] + public bool? PrioritizeUnhealthyInstances { get; set; } + + /// + /// Gets or sets rollback failed instances to previous model if the + /// Rolling Upgrade policy is violated. + /// + [JsonProperty(PropertyName = "rollbackFailedInstancesOnPolicyBreach")] + public bool? RollbackFailedInstancesOnPolicyBreach { get; set; } + + /// + /// Gets or sets create new virtual machines to upgrade the scale set, + /// rather than updating the existing virtual machines. Existing + /// virtual machines will be deleted once the new virtual machines are + /// created for each batch. + /// + [JsonProperty(PropertyName = "maxSurge")] + public bool? MaxSurge { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaxBatchInstancePercent != null) + { + if (MaxBatchInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxBatchInstancePercent", 100); + } + if (MaxBatchInstancePercent < 5) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxBatchInstancePercent", 5); + } + } + if (MaxUnhealthyInstancePercent != null) + { + if (MaxUnhealthyInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxUnhealthyInstancePercent", 100); + } + if (MaxUnhealthyInstancePercent < 5) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxUnhealthyInstancePercent", 5); + } + } + if (MaxUnhealthyUpgradedInstancePercent != null) + { + if (MaxUnhealthyUpgradedInstancePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxUnhealthyUpgradedInstancePercent", 100); + } + if (MaxUnhealthyUpgradedInstancePercent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxUnhealthyUpgradedInstancePercent", 0); + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeProgressInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeProgressInfo.cs new file mode 100644 index 000000000000..ba26df8d454d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeProgressInfo.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the number of virtual machine instances in each + /// upgrade state. + /// + public partial class RollingUpgradeProgressInfo + { + /// + /// Initializes a new instance of the RollingUpgradeProgressInfo class. + /// + public RollingUpgradeProgressInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeProgressInfo class. + /// + /// The number of instances that + /// have been successfully upgraded. + /// The number of instances that have + /// failed to be upgraded successfully. + /// The number of instances that + /// are currently being upgraded. + /// The number of instances that + /// have not yet begun to be upgraded. + public RollingUpgradeProgressInfo(int? successfulInstanceCount = default(int?), int? failedInstanceCount = default(int?), int? inProgressInstanceCount = default(int?), int? pendingInstanceCount = default(int?)) + { + SuccessfulInstanceCount = successfulInstanceCount; + FailedInstanceCount = failedInstanceCount; + InProgressInstanceCount = inProgressInstanceCount; + PendingInstanceCount = pendingInstanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the number of instances that have been successfully upgraded. + /// + [JsonProperty(PropertyName = "successfulInstanceCount")] + public int? SuccessfulInstanceCount { get; private set; } + + /// + /// Gets the number of instances that have failed to be upgraded + /// successfully. + /// + [JsonProperty(PropertyName = "failedInstanceCount")] + public int? FailedInstanceCount { get; private set; } + + /// + /// Gets the number of instances that are currently being upgraded. + /// + [JsonProperty(PropertyName = "inProgressInstanceCount")] + public int? InProgressInstanceCount { get; private set; } + + /// + /// Gets the number of instances that have not yet begun to be + /// upgraded. + /// + [JsonProperty(PropertyName = "pendingInstanceCount")] + public int? PendingInstanceCount { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeRunningStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeRunningStatus.cs new file mode 100644 index 000000000000..86014bd5619a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeRunningStatus.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the current running state of the overall upgrade. + /// + public partial class RollingUpgradeRunningStatus + { + /// + /// Initializes a new instance of the RollingUpgradeRunningStatus + /// class. + /// + public RollingUpgradeRunningStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeRunningStatus + /// class. + /// + /// Code indicating the current status of the + /// upgrade. Possible values include: 'RollingForward', 'Cancelled', + /// 'Completed', 'Faulted' + /// Start time of the upgrade. + /// The last action performed on the rolling + /// upgrade. Possible values include: 'Start', 'Cancel' + /// Last action time of the + /// upgrade. + public RollingUpgradeRunningStatus(RollingUpgradeStatusCode? code = default(RollingUpgradeStatusCode?), System.DateTime? startTime = default(System.DateTime?), RollingUpgradeActionType? lastAction = default(RollingUpgradeActionType?), System.DateTime? lastActionTime = default(System.DateTime?)) + { + Code = code; + StartTime = startTime; + LastAction = lastAction; + LastActionTime = lastActionTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets code indicating the current status of the upgrade. Possible + /// values include: 'RollingForward', 'Cancelled', 'Completed', + /// 'Faulted' + /// + [JsonProperty(PropertyName = "code")] + public RollingUpgradeStatusCode? Code { get; private set; } + + /// + /// Gets start time of the upgrade. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the last action performed on the rolling upgrade. Possible + /// values include: 'Start', 'Cancel' + /// + [JsonProperty(PropertyName = "lastAction")] + public RollingUpgradeActionType? LastAction { get; private set; } + + /// + /// Gets last action time of the upgrade. + /// + [JsonProperty(PropertyName = "lastActionTime")] + public System.DateTime? LastActionTime { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusCode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusCode.cs new file mode 100644 index 000000000000..9e108e8c1d93 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusCode.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RollingUpgradeStatusCode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RollingUpgradeStatusCode + { + [EnumMember(Value = "RollingForward")] + RollingForward, + [EnumMember(Value = "Cancelled")] + Cancelled, + [EnumMember(Value = "Completed")] + Completed, + [EnumMember(Value = "Faulted")] + Faulted + } + internal static class RollingUpgradeStatusCodeEnumExtension + { + internal static string ToSerializedValue(this RollingUpgradeStatusCode? value) + { + return value == null ? null : ((RollingUpgradeStatusCode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RollingUpgradeStatusCode value) + { + switch( value ) + { + case RollingUpgradeStatusCode.RollingForward: + return "RollingForward"; + case RollingUpgradeStatusCode.Cancelled: + return "Cancelled"; + case RollingUpgradeStatusCode.Completed: + return "Completed"; + case RollingUpgradeStatusCode.Faulted: + return "Faulted"; + } + return null; + } + + internal static RollingUpgradeStatusCode? ParseRollingUpgradeStatusCode(this string value) + { + switch( value ) + { + case "RollingForward": + return RollingUpgradeStatusCode.RollingForward; + case "Cancelled": + return RollingUpgradeStatusCode.Cancelled; + case "Completed": + return RollingUpgradeStatusCode.Completed; + case "Faulted": + return RollingUpgradeStatusCode.Faulted; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusInfo.cs new file mode 100644 index 000000000000..7c9078046b69 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RollingUpgradeStatusInfo.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of the latest virtual machine scale set rolling upgrade. + /// + [Rest.Serialization.JsonTransformation] + public partial class RollingUpgradeStatusInfo : Resource + { + /// + /// Initializes a new instance of the RollingUpgradeStatusInfo class. + /// + public RollingUpgradeStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeStatusInfo class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The rolling upgrade policies applied for this + /// upgrade. + /// Information about the current running + /// state of the overall upgrade. + /// Information about the number of virtual + /// machine instances in each upgrade state. + /// Error details for this upgrade, if there are + /// any. + public RollingUpgradeStatusInfo(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), RollingUpgradePolicy policy = default(RollingUpgradePolicy), RollingUpgradeRunningStatus runningStatus = default(RollingUpgradeRunningStatus), RollingUpgradeProgressInfo progress = default(RollingUpgradeProgressInfo), ApiError error = default(ApiError)) + : base(location, id, name, type, tags) + { + Policy = policy; + RunningStatus = runningStatus; + Progress = progress; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the rolling upgrade policies applied for this upgrade. + /// + [JsonProperty(PropertyName = "properties.policy")] + public RollingUpgradePolicy Policy { get; private set; } + + /// + /// Gets information about the current running state of the overall + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.runningStatus")] + public RollingUpgradeRunningStatus RunningStatus { get; private set; } + + /// + /// Gets information about the number of virtual machine instances in + /// each upgrade state. + /// + [JsonProperty(PropertyName = "properties.progress")] + public RollingUpgradeProgressInfo Progress { get; private set; } + + /// + /// Gets error details for this upgrade, if there are any. + /// + [JsonProperty(PropertyName = "properties.error")] + public ApiError Error { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Policy != null) + { + Policy.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocument.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocument.cs new file mode 100644 index 000000000000..d882f8dce44d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocument.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the properties of a Run Command. + /// + public partial class RunCommandDocument : RunCommandDocumentBase + { + /// + /// Initializes a new instance of the RunCommandDocument class. + /// + public RunCommandDocument() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandDocument class. + /// + /// The VM run command schema. + /// The VM run command id. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The VM run command label. + /// The VM run command description. + /// The script to be executed. + /// The parameters used by the script. + public RunCommandDocument(string schema, string id, OperatingSystemTypes osType, string label, string description, IList script, IList parameters = default(IList)) + : base(schema, id, osType, label, description) + { + Script = script; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the script to be executed. + /// + [JsonProperty(PropertyName = "script")] + public IList Script { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Script == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Script"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocumentBase.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocumentBase.cs new file mode 100644 index 000000000000..b80e0ea65ef4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandDocumentBase.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a Run Command metadata. + /// + public partial class RunCommandDocumentBase + { + /// + /// Initializes a new instance of the RunCommandDocumentBase class. + /// + public RunCommandDocumentBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandDocumentBase class. + /// + /// The VM run command schema. + /// The VM run command id. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The VM run command label. + /// The VM run command description. + public RunCommandDocumentBase(string schema, string id, OperatingSystemTypes osType, string label, string description) + { + Schema = schema; + Id = id; + OsType = osType; + Label = label; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the VM run command schema. + /// + [JsonProperty(PropertyName = "$schema")] + public string Schema { get; set; } + + /// + /// Gets or sets the VM run command id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets the VM run command label. + /// + [JsonProperty(PropertyName = "label")] + public string Label { get; set; } + + /// + /// Gets or sets the VM run command description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (Label == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Label"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInput.cs new file mode 100644 index 000000000000..ab1225bcb835 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInput.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Capture Virtual Machine parameters. + /// + public partial class RunCommandInput + { + /// + /// Initializes a new instance of the RunCommandInput class. + /// + public RunCommandInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandInput class. + /// + /// The run command id. + /// Optional. The script to be executed. When + /// this value is given, the given script will override the default + /// script of the command. + /// The run command parameters. + public RunCommandInput(string commandId, IList script = default(IList), IList parameters = default(IList)) + { + CommandId = commandId; + Script = script; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command id. + /// + [JsonProperty(PropertyName = "commandId")] + public string CommandId { get; set; } + + /// + /// Gets or sets optional. The script to be executed. When this value + /// is given, the given script will override the default script of the + /// command. + /// + [JsonProperty(PropertyName = "script")] + public IList Script { get; set; } + + /// + /// Gets or sets the run command parameters. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CommandId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CommandId"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInputParameter.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInputParameter.cs new file mode 100644 index 000000000000..0b652e908575 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandInputParameter.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a run command parameter. + /// + public partial class RunCommandInputParameter + { + /// + /// Initializes a new instance of the RunCommandInputParameter class. + /// + public RunCommandInputParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandInputParameter class. + /// + /// The run command parameter name. + /// The run command parameter value. + public RunCommandInputParameter(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command parameter name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the run command parameter value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandManagedIdentity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandManagedIdentity.cs new file mode 100644 index 000000000000..81433cf86400 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandManagedIdentity.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains clientId or objectId (use only one, not both) of a + /// user-assigned managed identity that has access to storage blob used in + /// Run Command. Use an empty RunCommandManagedIdentity object in case of + /// system-assigned identity. Make sure the Azure storage blob exists in + /// case of scriptUri, and managed identity has been given access to blob's + /// container with 'Storage Blob Data Reader' role assignment with + /// scriptUri blob and 'Storage Blob Data Contributor' for Append + /// blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, + /// make sure you add it under VM's identity. For more info on managed + /// identity and Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged. + /// + public partial class RunCommandManagedIdentity + { + /// + /// Initializes a new instance of the RunCommandManagedIdentity class. + /// + public RunCommandManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandManagedIdentity class. + /// + /// Client Id (GUID value) of the user-assigned + /// managed identity. ObjectId should not be used if this is + /// provided. + /// Object Id (GUID value) of the user-assigned + /// managed identity. ClientId should not be used if this is + /// provided. + public RunCommandManagedIdentity(string clientId = default(string), string objectId = default(string)) + { + ClientId = clientId; + ObjectId = objectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets client Id (GUID value) of the user-assigned managed + /// identity. ObjectId should not be used if this is provided. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets or sets object Id (GUID value) of the user-assigned managed + /// identity. ClientId should not be used if this is provided. + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandParameterDefinition.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandParameterDefinition.cs new file mode 100644 index 000000000000..b8acb1f1288a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandParameterDefinition.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a run command parameter. + /// + public partial class RunCommandParameterDefinition + { + /// + /// Initializes a new instance of the RunCommandParameterDefinition + /// class. + /// + public RunCommandParameterDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandParameterDefinition + /// class. + /// + /// The run command parameter name. + /// The run command parameter type. + /// The run command parameter default + /// value. + /// The run command parameter required. + public RunCommandParameterDefinition(string name, string type, string defaultValue = default(string), bool? required = default(bool?)) + { + Name = name; + Type = type; + DefaultValue = defaultValue; + Required = required; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the run command parameter name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the run command parameter type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the run command parameter default value. + /// + [JsonProperty(PropertyName = "defaultValue")] + public string DefaultValue { get; set; } + + /// + /// Gets or sets the run command parameter required. + /// + [JsonProperty(PropertyName = "required")] + public bool? Required { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandResult.cs new file mode 100644 index 000000000000..0bbd028fe22d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/RunCommandResult.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class RunCommandResult + { + /// + /// Initializes a new instance of the RunCommandResult class. + /// + public RunCommandResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RunCommandResult class. + /// + /// Run command operation response. + public RunCommandResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets run command operation response. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ScaleInPolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ScaleInPolicy.cs new file mode 100644 index 000000000000..8efbc05f8acb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ScaleInPolicy.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a scale-in policy for a virtual machine scale set. + /// + public partial class ScaleInPolicy + { + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + public ScaleInPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + /// The rules to be followed when scaling-in a + /// virtual machine scale set. <br><br> Possible values + /// are: <br><br> **Default** When a virtual machine scale + /// set is scaled in, the scale set will first be balanced across zones + /// if it is a zonal scale set. Then, it will be balanced across Fault + /// Domains as far as possible. Within each Fault Domain, the virtual + /// machines chosen for removal will be the newest ones that are not + /// protected from scale-in. <br><br> **OldestVM** When a + /// virtual machine scale set is being scaled-in, the oldest virtual + /// machines that are not protected from scale-in will be chosen for + /// removal. For zonal virtual machine scale sets, the scale set will + /// first be balanced across zones. Within each zone, the oldest + /// virtual machines that are not protected will be chosen for removal. + /// <br><br> **NewestVM** When a virtual machine scale set + /// is being scaled-in, the newest virtual machines that are not + /// protected from scale-in will be chosen for removal. For zonal + /// virtual machine scale sets, the scale set will first be balanced + /// across zones. Within each zone, the newest virtual machines that + /// are not protected will be chosen for removal. + /// <br><br> + /// This property allows you to specify if + /// virtual machines chosen for removal have to be force deleted when a + /// virtual machine scale set is being scaled-in.(Feature in + /// Preview) + public ScaleInPolicy(IList rules = default(IList), bool? forceDeletion = default(bool?)) + { + Rules = rules; + ForceDeletion = forceDeletion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rules to be followed when scaling-in a virtual + /// machine scale set. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Default** When a + /// virtual machine scale set is scaled in, the scale set will first be + /// balanced across zones if it is a zonal scale set. Then, it will be + /// balanced across Fault Domains as far as possible. Within each Fault + /// Domain, the virtual machines chosen for removal will be the newest + /// ones that are not protected from scale-in. + /// &lt;br&gt;&lt;br&gt; **OldestVM** When a virtual + /// machine scale set is being scaled-in, the oldest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the oldest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; **NewestVM** When a virtual + /// machine scale set is being scaled-in, the newest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the newest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + /// + /// Gets or sets this property allows you to specify if virtual + /// machines chosen for removal have to be force deleted when a virtual + /// machine scale set is being scaled-in.(Feature in Preview) + /// + [JsonProperty(PropertyName = "forceDeletion")] + public bool? ForceDeletion { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ScheduledEventsProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ScheduledEventsProfile.cs new file mode 100644 index 000000000000..6db4280f07c6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ScheduledEventsProfile.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ScheduledEventsProfile + { + /// + /// Initializes a new instance of the ScheduledEventsProfile class. + /// + public ScheduledEventsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduledEventsProfile class. + /// + /// Specifies Terminate + /// Scheduled Event related configurations. + /// Specifies OS Image + /// Scheduled Event related configurations. + public ScheduledEventsProfile(TerminateNotificationProfile terminateNotificationProfile = default(TerminateNotificationProfile), OSImageNotificationProfile osImageNotificationProfile = default(OSImageNotificationProfile)) + { + TerminateNotificationProfile = terminateNotificationProfile; + OsImageNotificationProfile = osImageNotificationProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies Terminate Scheduled Event related + /// configurations. + /// + [JsonProperty(PropertyName = "terminateNotificationProfile")] + public TerminateNotificationProfile TerminateNotificationProfile { get; set; } + + /// + /// Gets or sets specifies OS Image Scheduled Event related + /// configurations. + /// + [JsonProperty(PropertyName = "osImageNotificationProfile")] + public OSImageNotificationProfile OsImageNotificationProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityEncryptionTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityEncryptionTypes.cs new file mode 100644 index 000000000000..2a6faf169094 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityEncryptionTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SecurityEncryptionTypes. + /// + public static class SecurityEncryptionTypes + { + public const string VMGuestStateOnly = "VMGuestStateOnly"; + public const string DiskWithVMGuestState = "DiskWithVMGuestState"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityPostureReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityPostureReference.cs new file mode 100644 index 000000000000..69b7d4c83c0a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityPostureReference.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the security posture to be used for all virtual machines in + /// the scale set. Minimum api-version: 2023-03-01 + /// + public partial class SecurityPostureReference + { + /// + /// Initializes a new instance of the SecurityPostureReference class. + /// + public SecurityPostureReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityPostureReference class. + /// + /// The security posture reference id in the form of + /// /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest + /// List of virtual machine extensions + /// to exclude when applying the Security Posture. + public SecurityPostureReference(string id = default(string), IList excludeExtensions = default(IList)) + { + Id = id; + ExcludeExtensions = excludeExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the security posture reference id in the form of + /// /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets list of virtual machine extensions to exclude when + /// applying the Security Posture. + /// + [JsonProperty(PropertyName = "excludeExtensions")] + public IList ExcludeExtensions { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityProfile.cs new file mode 100644 index 000000000000..d24c0180f4e5 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityProfile.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the Security profile settings for the virtual machine or + /// virtual machine scale set. + /// + public partial class SecurityProfile + { + /// + /// Initializes a new instance of the SecurityProfile class. + /// + public SecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityProfile class. + /// + /// Specifies the security settings like + /// secure boot and vTPM used while creating the virtual machine. + /// Minimum api-version: 2020-12-01. + /// This property can be used by user in + /// the request to enable or disable the Host Encryption for the + /// virtual machine or virtual machine scale set. This will enable the + /// encryption for all the disks including Resource/Temp disk at host + /// itself. The default behavior is: The Encryption at host will be + /// disabled unless this property is set to true for the + /// resource. + /// Specifies the SecurityType of the + /// virtual machine. It has to be set to any specified value to enable + /// UefiSettings. The default behavior is: UefiSettings will not be + /// enabled unless this property is set. Possible values include: + /// 'TrustedLaunch', 'ConfidentialVM' + public SecurityProfile(UefiSettings uefiSettings = default(UefiSettings), bool? encryptionAtHost = default(bool?), string securityType = default(string)) + { + UefiSettings = uefiSettings; + EncryptionAtHost = encryptionAtHost; + SecurityType = securityType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the security settings like secure boot and + /// vTPM used while creating the virtual machine. Minimum api-version: + /// 2020-12-01. + /// + [JsonProperty(PropertyName = "uefiSettings")] + public UefiSettings UefiSettings { get; set; } + + /// + /// Gets or sets this property can be used by user in the request to + /// enable or disable the Host Encryption for the virtual machine or + /// virtual machine scale set. This will enable the encryption for all + /// the disks including Resource/Temp disk at host itself. The default + /// behavior is: The Encryption at host will be disabled unless this + /// property is set to true for the resource. + /// + [JsonProperty(PropertyName = "encryptionAtHost")] + public bool? EncryptionAtHost { get; set; } + + /// + /// Gets or sets specifies the SecurityType of the virtual machine. It + /// has to be set to any specified value to enable UefiSettings. The + /// default behavior is: UefiSettings will not be enabled unless this + /// property is set. Possible values include: 'TrustedLaunch', + /// 'ConfidentialVM' + /// + [JsonProperty(PropertyName = "securityType")] + public string SecurityType { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityTypes.cs new file mode 100644 index 000000000000..4c887f9ed9f1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SecurityTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SecurityTypes. + /// + public static class SecurityTypes + { + public const string TrustedLaunch = "TrustedLaunch"; + public const string ConfidentialVM = "ConfidentialVM"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SelectPermissions.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SelectPermissions.cs new file mode 100644 index 000000000000..dcd358cd68e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SelectPermissions.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SelectPermissions. + /// + public static class SelectPermissions + { + public const string Permissions = "Permissions"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ServiceArtifactReference.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ServiceArtifactReference.cs new file mode 100644 index 000000000000..4a669fe704c4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ServiceArtifactReference.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the service artifact reference id used to set same image + /// version for all virtual machines in the scale set when using 'latest' + /// image version. Minimum api-version: 2022-11-01 + /// + public partial class ServiceArtifactReference + { + /// + /// Initializes a new instance of the ServiceArtifactReference class. + /// + public ServiceArtifactReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceArtifactReference class. + /// + /// The service artifact reference id in the form of + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} + public ServiceArtifactReference(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the service artifact reference id in the form of + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SettingNames.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SettingNames.cs new file mode 100644 index 000000000000..85f6a7b9dd6c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SettingNames.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SettingNames. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SettingNames + { + [EnumMember(Value = "AutoLogon")] + AutoLogon, + [EnumMember(Value = "FirstLogonCommands")] + FirstLogonCommands + } + internal static class SettingNamesEnumExtension + { + internal static string ToSerializedValue(this SettingNames? value) + { + return value == null ? null : ((SettingNames)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SettingNames value) + { + switch( value ) + { + case SettingNames.AutoLogon: + return "AutoLogon"; + case SettingNames.FirstLogonCommands: + return "FirstLogonCommands"; + } + return null; + } + + internal static SettingNames? ParseSettingNames(this string value) + { + switch( value ) + { + case "AutoLogon": + return SettingNames.AutoLogon; + case "FirstLogonCommands": + return SettingNames.FirstLogonCommands; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ShareInfoElement.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ShareInfoElement.cs new file mode 100644 index 000000000000..95303e80160e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ShareInfoElement.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ShareInfoElement + { + /// + /// Initializes a new instance of the ShareInfoElement class. + /// + public ShareInfoElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ShareInfoElement class. + /// + /// A relative URI containing the ID of the VM that + /// has the disk attached. + public ShareInfoElement(string vmUri = default(string)) + { + VmUri = vmUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a relative URI containing the ID of the VM that has the disk + /// attached. + /// + [JsonProperty(PropertyName = "vmUri")] + public string VmUri { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGallery.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGallery.cs new file mode 100644 index 000000000000..aef86d0b185c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGallery.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// Specifies information about the Shared Gallery that you want to create + /// or update. + /// + public partial class SharedGallery : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGallery class. + /// + public SharedGallery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGallery class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + public SharedGallery(string name = default(string), string location = default(string), string uniqueId = default(string)) + : base(name, location, uniqueId) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDataDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDataDiskImage.cs new file mode 100644 index 000000000000..62c2d060be59 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDataDiskImage.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the data disk image. + /// + public partial class SharedGalleryDataDiskImage : SharedGalleryDiskImage + { + /// + /// Initializes a new instance of the SharedGalleryDataDiskImage class. + /// + public SharedGalleryDataDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryDataDiskImage class. + /// + /// This property specifies the logical unit number + /// of the data disk. This value is used to identify data disks within + /// the Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// This property indicates the size of the + /// VHD to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public SharedGalleryDataDiskImage(int lun, int? diskSizeGB = default(int?), string hostCaching = default(string)) + : base(diskSizeGB, hostCaching) + { + Lun = lun; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property specifies the logical unit number of the + /// data disk. This value is used to identify data disks within the + /// Virtual Machine and therefore must be unique for each data disk + /// attached to the Virtual Machine. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDiskImage.cs new file mode 100644 index 000000000000..590ac0462327 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryDiskImage.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This is the disk image base class. + /// + public partial class SharedGalleryDiskImage + { + /// + /// Initializes a new instance of the SharedGalleryDiskImage class. + /// + public SharedGalleryDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryDiskImage class. + /// + /// This property indicates the size of the + /// VHD to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public SharedGalleryDiskImage(int? diskSizeGB = default(int?), string hostCaching = default(string)) + { + DiskSizeGB = diskSizeGB; + HostCaching = hostCaching; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this property indicates the size of the VHD to be created. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; private set; } + + /// + /// Gets or sets the host caching of the disk. Valid values are 'None', + /// 'ReadOnly', and 'ReadWrite'. Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "hostCaching")] + public string HostCaching { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryHostCaching.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryHostCaching.cs new file mode 100644 index 000000000000..84edad26f060 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryHostCaching.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SharedGalleryHostCaching. + /// + public static class SharedGalleryHostCaching + { + public const string None = "None"; + public const string ReadOnly = "ReadOnly"; + public const string ReadWrite = "ReadWrite"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImage.cs new file mode 100644 index 000000000000..9874402ac0c7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImage.cs @@ -0,0 +1,186 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery image definition that you want + /// to create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class SharedGalleryImage : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGalleryImage class. + /// + public SharedGalleryImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryImage class. + /// + /// This property allows you to specify the type + /// of the OS that is included in the disk when creating a VM from a + /// managed image. <br><br> Possible values are: + /// <br><br> **Windows** <br><br> **Linux**. + /// Possible values include: 'Windows', 'Linux' + /// This property allows the user to specify + /// whether the virtual machines created under this image are + /// 'Generalized' or 'Specialized'. Possible values include: + /// 'Generalized', 'Specialized' + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + /// The end of life date of the gallery + /// image definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// A list of gallery image features. + /// Possible values include: 'x64', + /// 'Arm64' + /// Privacy statement uri for the + /// current community gallery image. + /// End-user license agreement for the current + /// community gallery image. + public SharedGalleryImage(OperatingSystemTypes osType, OperatingSystemStateTypes osState, GalleryImageIdentifier identifier, string name = default(string), string location = default(string), string uniqueId = default(string), System.DateTime? endOfLifeDate = default(System.DateTime?), RecommendedMachineConfiguration recommended = default(RecommendedMachineConfiguration), Disallowed disallowed = default(Disallowed), string hyperVGeneration = default(string), IList features = default(IList), ImagePurchasePlan purchasePlan = default(ImagePurchasePlan), string architecture = default(string), string privacyStatementUri = default(string), string eula = default(string)) + : base(name, location, uniqueId) + { + OsType = osType; + OsState = osState; + EndOfLifeDate = endOfLifeDate; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + HyperVGeneration = hyperVGeneration; + Features = features; + PurchasePlan = purchasePlan; + Architecture = architecture; + PrivacyStatementUri = privacyStatementUri; + Eula = eula; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk when creating a VM from a managed + /// image. &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **Windows** + /// &lt;br&gt;&lt;br&gt; **Linux**. Possible values + /// include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes OsType { get; set; } + + /// + /// Gets or sets this property allows the user to specify whether the + /// virtual machines created under this image are 'Generalized' or + /// 'Specialized'. Possible values include: 'Generalized', + /// 'Specialized' + /// + [JsonProperty(PropertyName = "properties.osState")] + public OperatingSystemStateTypes OsState { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image definition. + /// This property can be used for decommissioning purposes. This + /// property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.identifier")] + public GalleryImageIdentifier Identifier { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommended")] + public RecommendedMachineConfiguration Recommended { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public Disallowed Disallowed { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets a list of gallery image features. + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public ImagePurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets possible values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "properties.architecture")] + public string Architecture { get; set; } + + /// + /// Gets or sets privacy statement uri for the current community + /// gallery image. + /// + [JsonProperty(PropertyName = "properties.privacyStatementUri")] + public string PrivacyStatementUri { get; set; } + + /// + /// Gets or sets end-user license agreement for the current community + /// gallery image. + /// + [JsonProperty(PropertyName = "properties.eula")] + public string Eula { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Identifier"); + } + if (Identifier != null) + { + Identifier.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersion.cs new file mode 100644 index 000000000000..c9c40cfc649c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersion.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the gallery image version that you want to + /// create or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class SharedGalleryImageVersion : PirSharedGalleryResource + { + /// + /// Initializes a new instance of the SharedGalleryImageVersion class. + /// + public SharedGalleryImageVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryImageVersion class. + /// + /// Resource name + /// Resource location + /// The unique id of this shared + /// gallery. + /// The published date of the gallery image + /// version Definition. This property can be used for decommissioning + /// purposes. This property is updatable. + /// The end of life date of the gallery + /// image version Definition. This property can be used for + /// decommissioning purposes. This property is updatable. + /// If set to true, Virtual Machines + /// deployed from the latest version of the Image Definition won't use + /// this Image Version. + /// Describes the storage profile of the + /// image version. + public SharedGalleryImageVersion(string name = default(string), string location = default(string), string uniqueId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? endOfLifeDate = default(System.DateTime?), bool? excludeFromLatest = default(bool?), SharedGalleryImageVersionStorageProfile storageProfile = default(SharedGalleryImageVersionStorageProfile)) + : base(name, location, uniqueId) + { + PublishedDate = publishedDate; + EndOfLifeDate = endOfLifeDate; + ExcludeFromLatest = excludeFromLatest; + StorageProfile = storageProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the published date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.publishedDate")] + public System.DateTime? PublishedDate { get; set; } + + /// + /// Gets or sets the end of life date of the gallery image version + /// Definition. This property can be used for decommissioning purposes. + /// This property is updatable. + /// + [JsonProperty(PropertyName = "properties.endOfLifeDate")] + public System.DateTime? EndOfLifeDate { get; set; } + + /// + /// Gets or sets if set to true, Virtual Machines deployed from the + /// latest version of the Image Definition won't use this Image + /// Version. + /// + [JsonProperty(PropertyName = "properties.excludeFromLatest")] + public bool? ExcludeFromLatest { get; set; } + + /// + /// Gets or sets describes the storage profile of the image version. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public SharedGalleryImageVersionStorageProfile StorageProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersionStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersionStorageProfile.cs new file mode 100644 index 000000000000..0e9a4a85dd6a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryImageVersionStorageProfile.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This is the storage profile of a Gallery Image Version. + /// + public partial class SharedGalleryImageVersionStorageProfile + { + /// + /// Initializes a new instance of the + /// SharedGalleryImageVersionStorageProfile class. + /// + public SharedGalleryImageVersionStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SharedGalleryImageVersionStorageProfile class. + /// + /// A list of data disk images. + public SharedGalleryImageVersionStorageProfile(SharedGalleryOSDiskImage osDiskImage = default(SharedGalleryOSDiskImage), IList dataDiskImages = default(IList)) + { + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "osDiskImage")] + public SharedGalleryOSDiskImage OsDiskImage { get; set; } + + /// + /// Gets or sets a list of data disk images. + /// + [JsonProperty(PropertyName = "dataDiskImages")] + public IList DataDiskImages { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryOSDiskImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryOSDiskImage.cs new file mode 100644 index 000000000000..a89a7a8847da --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedGalleryOSDiskImage.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// This is the OS disk image. + /// + public partial class SharedGalleryOSDiskImage : SharedGalleryDiskImage + { + /// + /// Initializes a new instance of the SharedGalleryOSDiskImage class. + /// + public SharedGalleryOSDiskImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedGalleryOSDiskImage class. + /// + /// This property indicates the size of the + /// VHD to be created. + /// The host caching of the disk. Valid + /// values are 'None', 'ReadOnly', and 'ReadWrite'. Possible values + /// include: 'None', 'ReadOnly', 'ReadWrite' + public SharedGalleryOSDiskImage(int? diskSizeGB = default(int?), string hostCaching = default(string)) + : base(diskSizeGB, hostCaching) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharedToValues.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedToValues.cs new file mode 100644 index 000000000000..463c15183c04 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharedToValues.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SharedToValues. + /// + public static class SharedToValues + { + public const string Tenant = "tenant"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfile.cs new file mode 100644 index 000000000000..24388232662c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfile.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile for gallery sharing to subscription or tenant + /// + public partial class SharingProfile + { + /// + /// Initializes a new instance of the SharingProfile class. + /// + public SharingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingProfile class. + /// + /// This property allows you to specify the + /// permission of sharing gallery. <br><br> Possible values + /// are: <br><br> **Private** <br><br> + /// **Groups** <br><br> **Community**. Possible values + /// include: 'Private', 'Groups', 'Community' + /// A list of sharing profile groups. + /// Information of community gallery + /// if current gallery is shared to community. + public SharingProfile(string permissions = default(string), IList groups = default(IList), CommunityGalleryInfo communityGalleryInfo = default(CommunityGalleryInfo)) + { + Permissions = permissions; + Groups = groups; + CommunityGalleryInfo = communityGalleryInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the permission of + /// sharing gallery. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Private** + /// &lt;br&gt;&lt;br&gt; **Groups** + /// &lt;br&gt;&lt;br&gt; **Community**. Possible values + /// include: 'Private', 'Groups', 'Community' + /// + [JsonProperty(PropertyName = "permissions")] + public string Permissions { get; set; } + + /// + /// Gets a list of sharing profile groups. + /// + [JsonProperty(PropertyName = "groups")] + public IList Groups { get; private set; } + + /// + /// Gets or sets information of community gallery if current gallery is + /// shared to community. + /// + [JsonProperty(PropertyName = "communityGalleryInfo")] + public CommunityGalleryInfo CommunityGalleryInfo { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroup.cs new file mode 100644 index 000000000000..7a8e4df6262c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroup.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Group of the gallery sharing profile + /// + public partial class SharingProfileGroup + { + /// + /// Initializes a new instance of the SharingProfileGroup class. + /// + public SharingProfileGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingProfileGroup class. + /// + /// This property allows you to specify the type of + /// sharing group. <br><br> Possible values are: + /// <br><br> **Subscriptions** <br><br> + /// **AADTenants**. Possible values include: 'Subscriptions', + /// 'AADTenants' + /// A list of subscription/tenant ids the gallery is + /// aimed to be shared to. + public SharingProfileGroup(string type = default(string), IList ids = default(IList)) + { + Type = type; + Ids = ids; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the type of + /// sharing group. &lt;br&gt;&lt;br&gt; Possible values + /// are: &lt;br&gt;&lt;br&gt; **Subscriptions** + /// &lt;br&gt;&lt;br&gt; **AADTenants**. Possible + /// values include: 'Subscriptions', 'AADTenants' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets a list of subscription/tenant ids the gallery is aimed + /// to be shared to. + /// + [JsonProperty(PropertyName = "ids")] + public IList Ids { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroupTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroupTypes.cs new file mode 100644 index 000000000000..1f1724bed836 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingProfileGroupTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SharingProfileGroupTypes. + /// + public static class SharingProfileGroupTypes + { + public const string Subscriptions = "Subscriptions"; + public const string AADTenants = "AADTenants"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingState.cs new file mode 100644 index 000000000000..0042d62cee82 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SharingState. + /// + public static class SharingState + { + public const string Succeeded = "Succeeded"; + public const string InProgress = "InProgress"; + public const string Failed = "Failed"; + public const string Unknown = "Unknown"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingStatus.cs new file mode 100644 index 000000000000..b3c80c0b425d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingStatus.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Sharing status of current gallery. + /// + public partial class SharingStatus + { + /// + /// Initializes a new instance of the SharingStatus class. + /// + public SharingStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingStatus class. + /// + /// Aggregated sharing state of current + /// gallery. Possible values include: 'Succeeded', 'InProgress', + /// 'Failed', 'Unknown' + /// Summary of all regional sharing + /// status. + public SharingStatus(string aggregatedState = default(string), IList summary = default(IList)) + { + AggregatedState = aggregatedState; + Summary = summary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets aggregated sharing state of current gallery. Possible + /// values include: 'Succeeded', 'InProgress', 'Failed', 'Unknown' + /// + [JsonProperty(PropertyName = "aggregatedState")] + public string AggregatedState { get; set; } + + /// + /// Gets or sets summary of all regional sharing status. + /// + [JsonProperty(PropertyName = "summary")] + public IList Summary { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdate.cs new file mode 100644 index 000000000000..e0c8b03447c8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdate.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the gallery sharing profile update. + /// + public partial class SharingUpdate : IResource + { + /// + /// Initializes a new instance of the SharingUpdate class. + /// + public SharingUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharingUpdate class. + /// + /// This property allows you to specify the + /// operation type of gallery sharing update. <br><br> + /// Possible values are: <br><br> **Add** + /// <br><br> **Remove** <br><br> **Reset**. + /// Possible values include: 'Add', 'Remove', 'Reset', + /// 'EnableCommunity' + /// A list of sharing profile groups. + public SharingUpdate(string operationType, IList groups = default(IList)) + { + OperationType = operationType; + Groups = groups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property allows you to specify the operation type + /// of gallery sharing update. &lt;br&gt;&lt;br&gt; + /// Possible values are: &lt;br&gt;&lt;br&gt; **Add** + /// &lt;br&gt;&lt;br&gt; **Remove** + /// &lt;br&gt;&lt;br&gt; **Reset**. Possible values + /// include: 'Add', 'Remove', 'Reset', 'EnableCommunity' + /// + [JsonProperty(PropertyName = "operationType")] + public string OperationType { get; set; } + + /// + /// Gets or sets a list of sharing profile groups. + /// + [JsonProperty(PropertyName = "groups")] + public IList Groups { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperationType"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdateOperationTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdateOperationTypes.cs new file mode 100644 index 000000000000..a778c2867b58 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SharingUpdateOperationTypes.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SharingUpdateOperationTypes. + /// + public static class SharingUpdateOperationTypes + { + public const string Add = "Add"; + public const string Remove = "Remove"; + public const string Reset = "Reset"; + public const string EnableCommunity = "EnableCommunity"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Sku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Sku.cs new file mode 100644 index 000000000000..3a3bbc4c45bd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Sku.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machine scale set sku. NOTE: If the new VM SKU is + /// not supported on the hardware the scale set is currently on, you need + /// to deallocate the VMs in the scale set before you modify the SKU name. + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The sku name. + /// Specifies the tier of virtual machines in a + /// scale set.<br /><br /> Possible Values:<br + /// /><br /> **Standard**<br /><br /> + /// **Basic** + /// Specifies the number of virtual machines in + /// the scale set. + public Sku(string name = default(string), string tier = default(string), long? capacity = default(long?)) + { + Name = name; + Tier = tier; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the tier of virtual machines in a scale + /// set.&lt;br /&gt;&lt;br /&gt; Possible + /// Values:&lt;br /&gt;&lt;br /&gt; + /// **Standard**&lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets specifies the number of virtual machines in the scale + /// set. + /// + [JsonProperty(PropertyName = "capacity")] + public long? Capacity { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Snapshot.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Snapshot.cs new file mode 100644 index 000000000000..e0cf9559fa28 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Snapshot.cs @@ -0,0 +1,357 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Snapshot resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Snapshot : Resource + { + /// + /// Initializes a new instance of the Snapshot class. + /// + public Snapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Snapshot class. + /// + /// Resource location + /// Disk source information. CreationData + /// information cannot be changed after the disk has been + /// created. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Unused. Always Null. + /// The extended location where the + /// snapshot will be created. Extended location cannot be + /// changed. + /// The time when the snapshot was + /// created. + /// The Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// The hypervisor generation of the + /// Virtual Machine. Applicable to OS disks only. Possible values + /// include: 'V1', 'V2' + /// Purchase plan information for the image + /// from which the source disk for the snapshot was originally + /// created. + /// List of supported capabilities + /// for the image from which the source disk from the snapshot was + /// originally created. + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// The size of the disk in bytes. This + /// field is read only. + /// The state of the snapshot. Possible values + /// include: 'Unattached', 'Attached', 'Reserved', 'Frozen', + /// 'ActiveSAS', 'ActiveSASFrozen', 'ReadyToUpload', + /// 'ActiveUpload' + /// Unique Guid identifying the + /// resource. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// The disk provisioning + /// state. + /// Whether a snapshot is incremental. + /// Incremental snapshots on the same disk occupy less space than full + /// snapshots and can be diffed. + /// Incremental snapshots for + /// a disk share an incremental snapshot family id. The Get Page Range + /// Diff API can only be called on incremental snapshots with the same + /// family id. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Contains the security related + /// information for the resource. + /// Indicates the OS on a snapshot + /// supports hibernation. + /// Possible values include: + /// 'Enabled', 'Disabled' + /// Percentage complete for the + /// background copy when a resource is created via the CopyStart + /// operation. + /// Indicates the error details if + /// the background copy of a resource created via the CopyStart + /// operation fails. + /// Possible values include: + /// 'AzureActiveDirectory', 'None' + public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), ExtendedLocation extendedLocation = default(ExtendedLocation), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), PurchasePlan purchasePlan = default(PurchasePlan), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string diskState = default(string), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), string incrementalSnapshotFamilyId = default(string), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), DiskSecurityProfile securityProfile = default(DiskSecurityProfile), bool? supportsHibernation = default(bool?), string publicNetworkAccess = default(string), double? completionPercent = default(double?), CopyCompletionError copyCompletionError = default(CopyCompletionError), string dataAccessAuthMode = default(string)) + : base(location, id, name, type, tags) + { + ManagedBy = managedBy; + Sku = sku; + ExtendedLocation = extendedLocation; + TimeCreated = timeCreated; + OsType = osType; + HyperVGeneration = hyperVGeneration; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + CreationData = creationData; + DiskSizeGB = diskSizeGB; + DiskSizeBytes = diskSizeBytes; + DiskState = diskState; + UniqueId = uniqueId; + EncryptionSettingsCollection = encryptionSettingsCollection; + ProvisioningState = provisioningState; + Incremental = incremental; + IncrementalSnapshotFamilyId = incrementalSnapshotFamilyId; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SecurityProfile = securityProfile; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + CompletionPercent = completionPercent; + CopyCompletionError = copyCompletionError; + DataAccessAuthMode = dataAccessAuthMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets unused. Always Null. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public SnapshotSku Sku { get; set; } + + /// + /// Gets or sets the extended location where the snapshot will be + /// created. Extended location cannot be changed. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets the time when the snapshot was created. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine. + /// Applicable to OS disks only. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets purchase plan information for the image from which the + /// source disk for the snapshot was originally created. + /// + [JsonProperty(PropertyName = "properties.purchasePlan")] + public PurchasePlan PurchasePlan { get; set; } + + /// + /// Gets or sets list of supported capabilities for the image from + /// which the source disk from the snapshot was originally created. + /// + [JsonProperty(PropertyName = "properties.supportedCapabilities")] + public SupportedCapabilities SupportedCapabilities { get; set; } + + /// + /// Gets or sets disk source information. CreationData information + /// cannot be changed after the disk has been created. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets the size of the disk in bytes. This field is read only. + /// + [JsonProperty(PropertyName = "properties.diskSizeBytes")] + public long? DiskSizeBytes { get; private set; } + + /// + /// Gets or sets the state of the snapshot. Possible values include: + /// 'Unattached', 'Attached', 'Reserved', 'Frozen', 'ActiveSAS', + /// 'ActiveSASFrozen', 'ReadyToUpload', 'ActiveUpload' + /// + [JsonProperty(PropertyName = "properties.diskState")] + public string DiskState { get; set; } + + /// + /// Gets unique Guid identifying the resource. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets the disk provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets whether a snapshot is incremental. Incremental + /// snapshots on the same disk occupy less space than full snapshots + /// and can be diffed. + /// + [JsonProperty(PropertyName = "properties.incremental")] + public bool? Incremental { get; set; } + + /// + /// Gets incremental snapshots for a disk share an incremental snapshot + /// family id. The Get Page Range Diff API can only be called on + /// incremental snapshots with the same family id. + /// + [JsonProperty(PropertyName = "properties.incrementalSnapshotFamilyId")] + public string IncrementalSnapshotFamilyId { get; private set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets contains the security related information for the + /// resource. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public DiskSecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets indicates the OS on a snapshot supports hibernation. + /// + [JsonProperty(PropertyName = "properties.supportsHibernation")] + public bool? SupportsHibernation { get; set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets percentage complete for the background copy when a + /// resource is created via the CopyStart operation. + /// + [JsonProperty(PropertyName = "properties.completionPercent")] + public double? CompletionPercent { get; set; } + + /// + /// Gets or sets indicates the error details if the background copy of + /// a resource created via the CopyStart operation fails. + /// + [JsonProperty(PropertyName = "properties.copyCompletionError")] + public CopyCompletionError CopyCompletionError { get; set; } + + /// + /// Gets or sets possible values include: 'AzureActiveDirectory', + /// 'None' + /// + [JsonProperty(PropertyName = "properties.dataAccessAuthMode")] + public string DataAccessAuthMode { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CreationData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreationData"); + } + if (PurchasePlan != null) + { + PurchasePlan.Validate(); + } + if (CreationData != null) + { + CreationData.Validate(); + } + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + if (CopyCompletionError != null) + { + CopyCompletionError.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotSku.cs new file mode 100644 index 000000000000..4f67ff26f261 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotSku.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or + /// Standard_ZRS. This is an optional parameter for incremental snapshot + /// and the default behavior is the SKU will be set to the same sku as the + /// previous snapshot + /// + public partial class SnapshotSku + { + /// + /// Initializes a new instance of the SnapshotSku class. + /// + public SnapshotSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SnapshotSku class. + /// + /// The sku name. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'Standard_ZRS' + /// The sku tier. + public SnapshotSku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku name. Possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'Standard_ZRS' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the sku tier. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotStorageAccountTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotStorageAccountTypes.cs new file mode 100644 index 000000000000..966937f79089 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotStorageAccountTypes.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for SnapshotStorageAccountTypes. + /// + public static class SnapshotStorageAccountTypes + { + /// + /// Standard HDD locally redundant storage + /// + public const string StandardLRS = "Standard_LRS"; + /// + /// Premium SSD locally redundant storage + /// + public const string PremiumLRS = "Premium_LRS"; + /// + /// Standard zone redundant storage + /// + public const string StandardZRS = "Standard_ZRS"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotUpdate.cs new file mode 100644 index 000000000000..ebbb9ae08e07 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SnapshotUpdate.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Snapshot update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SnapshotUpdate + { + /// + /// Initializes a new instance of the SnapshotUpdate class. + /// + public SnapshotUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SnapshotUpdate class. + /// + /// the Operating System type. Possible values + /// include: 'Windows', 'Linux' + /// If creationData.createOption is Empty, + /// this field is mandatory and it indicates the size of the disk to + /// create. If this field is present for updates or creation with other + /// options, it indicates a resize. Resizes are only allowed if the + /// disk is not attached to a running VM, and can only increase the + /// disk's size. + /// Encryption settings + /// collection used be Azure Disk Encryption, can contain multiple + /// encryption settings per disk or snapshot. + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + /// Possible values include: + /// 'AllowAll', 'AllowPrivate', 'DenyAll' + /// ARM id of the DiskAccess resource for + /// using private endpoints on disks. + /// Indicates the OS on a snapshot + /// supports hibernation. + /// Possible values include: + /// 'Enabled', 'Disabled' + /// Possible values include: + /// 'AzureActiveDirectory', 'None' + /// List of supported capabilities + /// for the image from which the OS disk was created. + /// Resource tags + public SnapshotUpdate(OperatingSystemTypes? osType = default(OperatingSystemTypes?), int? diskSizeGB = default(int?), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), Encryption encryption = default(Encryption), string networkAccessPolicy = default(string), string diskAccessId = default(string), bool? supportsHibernation = default(bool?), string publicNetworkAccess = default(string), string dataAccessAuthMode = default(string), SupportedCapabilities supportedCapabilities = default(SupportedCapabilities), IDictionary tags = default(IDictionary), SnapshotSku sku = default(SnapshotSku)) + { + OsType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsCollection = encryptionSettingsCollection; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + SupportedCapabilities = supportedCapabilities; + Tags = tags; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Operating System type. Possible values include: + /// 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "properties.osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets if creationData.createOption is Empty, this field is + /// mandatory and it indicates the size of the disk to create. If this + /// field is present for updates or creation with other options, it + /// indicates a resize. Resizes are only allowed if the disk is not + /// attached to a running VM, and can only increase the disk's size. + /// + [JsonProperty(PropertyName = "properties.diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets encryption settings collection used be Azure Disk + /// Encryption, can contain multiple encryption settings per disk or + /// snapshot. + /// + [JsonProperty(PropertyName = "properties.encryptionSettingsCollection")] + public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; } + + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + + /// + /// Gets or sets possible values include: 'AllowAll', 'AllowPrivate', + /// 'DenyAll' + /// + [JsonProperty(PropertyName = "properties.networkAccessPolicy")] + public string NetworkAccessPolicy { get; set; } + + /// + /// Gets or sets ARM id of the DiskAccess resource for using private + /// endpoints on disks. + /// + [JsonProperty(PropertyName = "properties.diskAccessId")] + public string DiskAccessId { get; set; } + + /// + /// Gets or sets indicates the OS on a snapshot supports hibernation. + /// + [JsonProperty(PropertyName = "properties.supportsHibernation")] + public bool? SupportsHibernation { get; set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets possible values include: 'AzureActiveDirectory', + /// 'None' + /// + [JsonProperty(PropertyName = "properties.dataAccessAuthMode")] + public string DataAccessAuthMode { get; set; } + + /// + /// Gets or sets list of supported capabilities for the image from + /// which the OS disk was created. + /// + [JsonProperty(PropertyName = "properties.supportedCapabilities")] + public SupportedCapabilities SupportedCapabilities { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public SnapshotSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EncryptionSettingsCollection != null) + { + EncryptionSettingsCollection.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SoftDeletePolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SoftDeletePolicy.cs new file mode 100644 index 000000000000..d0aa93c2b533 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SoftDeletePolicy.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information about the soft deletion policy of the gallery. + /// + public partial class SoftDeletePolicy + { + /// + /// Initializes a new instance of the SoftDeletePolicy class. + /// + public SoftDeletePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SoftDeletePolicy class. + /// + /// Enables soft-deletion for + /// resources in this gallery, allowing them to be recovered within + /// retention time. + public SoftDeletePolicy(bool? isSoftDeleteEnabled = default(bool?)) + { + IsSoftDeleteEnabled = isSoftDeleteEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets enables soft-deletion for resources in this gallery, + /// allowing them to be recovered within retention time. + /// + [JsonProperty(PropertyName = "isSoftDeleteEnabled")] + public bool? IsSoftDeleteEnabled { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SourceVault.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SourceVault.cs new file mode 100644 index 000000000000..3d5219938ba9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SourceVault.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The vault id is an Azure Resource Manager Resource id in the form + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + public partial class SourceVault + { + /// + /// Initializes a new instance of the SourceVault class. + /// + public SourceVault() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceVault class. + /// + /// Resource Id + public SourceVault(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SpotRestorePolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SpotRestorePolicy.cs new file mode 100644 index 000000000000..3bbc5225f215 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SpotRestorePolicy.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the Spot-Try-Restore properties for the virtual machine scale + /// set. With this property customer can enable or disable automatic + /// restore of the evicted Spot VMSS VM instances opportunistically based + /// on capacity availability and pricing constraint. + /// + public partial class SpotRestorePolicy + { + /// + /// Initializes a new instance of the SpotRestorePolicy class. + /// + public SpotRestorePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SpotRestorePolicy class. + /// + /// Enables the Spot-Try-Restore feature where + /// evicted VMSS SPOT instances will be tried to be restored + /// opportunistically based on capacity availability and pricing + /// constraints + /// Timeout value expressed as an ISO 8601 + /// time duration after which the platform will not try to restore the + /// VMSS SPOT instances + public SpotRestorePolicy(bool? enabled = default(bool?), string restoreTimeout = default(string)) + { + Enabled = enabled; + RestoreTimeout = restoreTimeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets enables the Spot-Try-Restore feature where evicted + /// VMSS SPOT instances will be tried to be restored opportunistically + /// based on capacity availability and pricing constraints + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets timeout value expressed as an ISO 8601 time duration + /// after which the platform will not try to restore the VMSS SPOT + /// instances + /// + [JsonProperty(PropertyName = "restoreTimeout")] + public string RestoreTimeout { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SshConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SshConfiguration.cs new file mode 100644 index 000000000000..fb30d37d3d54 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SshConfiguration.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SSH configuration for Linux based VMs running on Azure + /// + public partial class SshConfiguration + { + /// + /// Initializes a new instance of the SshConfiguration class. + /// + public SshConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshConfiguration class. + /// + /// The list of SSH public keys used to + /// authenticate with linux based VMs. + public SshConfiguration(IList publicKeys = default(IList)) + { + PublicKeys = publicKeys; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of SSH public keys used to authenticate with + /// linux based VMs. + /// + [JsonProperty(PropertyName = "publicKeys")] + public IList PublicKeys { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKey.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKey.cs new file mode 100644 index 000000000000..8ba357135884 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKey.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information about SSH certificate public key and the path on + /// the Linux VM where the public key is placed. + /// + public partial class SshPublicKey + { + /// + /// Initializes a new instance of the SshPublicKey class. + /// + public SshPublicKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKey class. + /// + /// Specifies the full path on the created VM where + /// ssh public key is stored. If the file already exists, the specified + /// key is appended to the file. Example: + /// /home/user/.ssh/authorized_keys + /// SSH public key certificate used to + /// authenticate with the VM through ssh. The key needs to be at least + /// 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create + /// SSH keys on Linux and Mac for Linux VMs in + /// Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + public SshPublicKey(string path = default(string), string keyData = default(string)) + { + Path = path; + KeyData = keyData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the full path on the created VM where ssh + /// public key is stored. If the file already exists, the specified key + /// is appended to the file. Example: /home/user/.ssh/authorized_keys + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets SSH public key certificate used to authenticate with + /// the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format. For creating ssh keys, see [Create SSH keys on + /// Linux and Mac for Linux VMs in + /// Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + /// + [JsonProperty(PropertyName = "keyData")] + public string KeyData { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs new file mode 100644 index 000000000000..35ef9c46d432 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response from generation of an SSH key pair. + /// + public partial class SshPublicKeyGenerateKeyPairResult + { + /// + /// Initializes a new instance of the SshPublicKeyGenerateKeyPairResult + /// class. + /// + public SshPublicKeyGenerateKeyPairResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyGenerateKeyPairResult + /// class. + /// + /// Private key portion of the key pair used + /// to authenticate to a virtual machine through ssh. The private key + /// is returned in RFC3447 format and should be treated as a + /// secret. + /// Public key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The public key is in + /// ssh-rsa format. + /// The ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + public SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey, string id) + { + PrivateKey = privateKey; + PublicKey = publicKey; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets private key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The private key is + /// returned in RFC3447 format and should be treated as a secret. + /// + [JsonProperty(PropertyName = "privateKey")] + public string PrivateKey { get; set; } + + /// + /// Gets or sets public key portion of the key pair used to + /// authenticate to a virtual machine through ssh. The public key is in + /// ssh-rsa format. + /// + [JsonProperty(PropertyName = "publicKey")] + public string PublicKey { get; set; } + + /// + /// Gets or sets the ARM resource id in the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateKey"); + } + if (PublicKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PublicKey"); + } + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyResource.cs new file mode 100644 index 000000000000..409120e82f04 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the SSH public key. + /// + [Rest.Serialization.JsonTransformation] + public partial class SshPublicKeyResource : Resource + { + /// + /// Initializes a new instance of the SshPublicKeyResource class. + /// + public SshPublicKeyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyResource class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// 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. + public SshPublicKeyResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string publicKey = default(string)) + : base(location, id, name, type, tags) + { + PublicKey = publicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.publicKey")] + public string PublicKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyUpdateResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyUpdateResource.cs new file mode 100644 index 000000000000..9a42496ed622 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SshPublicKeyUpdateResource.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies information about the SSH public key. + /// + [Rest.Serialization.JsonTransformation] + public partial class SshPublicKeyUpdateResource : UpdateResource + { + /// + /// Initializes a new instance of the SshPublicKeyUpdateResource class. + /// + public SshPublicKeyUpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKeyUpdateResource class. + /// + /// Resource tags + /// 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. + public SshPublicKeyUpdateResource(IDictionary tags = default(IDictionary), string publicKey = default(string)) + : base(tags) + { + PublicKey = publicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.publicKey")] + public string PublicKey { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/StatusCodeCount.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/StatusCodeCount.cs new file mode 100644 index 000000000000..e67296e73bc8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/StatusCodeCount.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The status code and count of the cloud service instance view statuses + /// + public partial class StatusCodeCount + { + /// + /// Initializes a new instance of the StatusCodeCount class. + /// + public StatusCodeCount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatusCodeCount class. + /// + /// The instance view status code + /// Number of instances having this status + /// code + public StatusCodeCount(string code = default(string), int? count = default(int?)) + { + Code = code; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the instance view status code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets number of instances having this status code + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/StatusLevelTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/StatusLevelTypes.cs new file mode 100644 index 000000000000..1ce3be166e64 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/StatusLevelTypes.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for StatusLevelTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum StatusLevelTypes + { + [EnumMember(Value = "Info")] + Info, + [EnumMember(Value = "Warning")] + Warning, + [EnumMember(Value = "Error")] + Error + } + internal static class StatusLevelTypesEnumExtension + { + internal static string ToSerializedValue(this StatusLevelTypes? value) + { + return value == null ? null : ((StatusLevelTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this StatusLevelTypes value) + { + switch( value ) + { + case StatusLevelTypes.Info: + return "Info"; + case StatusLevelTypes.Warning: + return "Warning"; + case StatusLevelTypes.Error: + return "Error"; + } + return null; + } + + internal static StatusLevelTypes? ParseStatusLevelTypes(this string value) + { + switch( value ) + { + case "Info": + return StatusLevelTypes.Info; + case "Warning": + return StatusLevelTypes.Warning; + case "Error": + return StatusLevelTypes.Error; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountType.cs new file mode 100644 index 000000000000..ec564c0010b6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for StorageAccountType. + /// + public static class StorageAccountType + { + public const string StandardLRS = "Standard_LRS"; + public const string StandardZRS = "Standard_ZRS"; + public const string PremiumLRS = "Premium_LRS"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountTypes.cs new file mode 100644 index 000000000000..840b7e7dc687 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageAccountTypes.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for StorageAccountTypes. + /// + public static class StorageAccountTypes + { + public const string StandardLRS = "Standard_LRS"; + public const string PremiumLRS = "Premium_LRS"; + public const string StandardSSDLRS = "StandardSSD_LRS"; + public const string UltraSSDLRS = "UltraSSD_LRS"; + public const string PremiumZRS = "Premium_ZRS"; + public const string StandardSSDZRS = "StandardSSD_ZRS"; + public const string PremiumV2LRS = "PremiumV2_LRS"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/StorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageProfile.cs new file mode 100644 index 000000000000..a1d8453c7bf3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/StorageProfile.cs @@ -0,0 +1,139 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies the storage settings for the virtual machine disks. + /// + public partial class StorageProfile + { + /// + /// Initializes a new instance of the StorageProfile class. + /// + public StorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageProfile class. + /// + /// 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. + /// Specifies information about the operating + /// system disk used by the virtual machine. For more information about + /// disks, see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// Specifies the parameters that are used to + /// add a data disk to a virtual machine. For more information about + /// disks, see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// Specifies the disk controller type + /// configured for the VM. **Note:** This property will be set to the + /// default disk controller type if not specified provided virtual + /// machine is being created with 'hyperVGeneration' set to V2 based on + /// the capabilities of the operating system disk and VM size from the + /// the specified minimum api version. You need to deallocate the VM + /// before updating its disk controller type unless you are updating + /// the VM size in the VM configuration which implicitly deallocates + /// and reallocates the VM. Minimum api-version: 2022-08-01. Possible + /// values include: 'SCSI', 'NVMe' + public StorageProfile(ImageReference imageReference = default(ImageReference), OSDisk osDisk = default(OSDisk), IList dataDisks = default(IList), string diskControllerType = default(string)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + DiskControllerType = diskControllerType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machine. For more information about disks, see + /// [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "osDisk")] + public OSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add a data + /// disk to a virtual machine. For more information about disks, see + /// [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Gets or sets specifies the disk controller type configured for the + /// VM. **Note:** This property will be set to the default disk + /// controller type if not specified provided virtual machine is being + /// created with 'hyperVGeneration' set to V2 based on the capabilities + /// of the operating system disk and VM size from the the specified + /// minimum api version. You need to deallocate the VM before updating + /// its disk controller type unless you are updating the VM size in the + /// VM configuration which implicitly deallocates and reallocates the + /// VM. Minimum api-version: 2022-08-01. Possible values include: + /// 'SCSI', 'NVMe' + /// + [JsonProperty(PropertyName = "diskControllerType")] + public string DiskControllerType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SubResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResource.cs new file mode 100644 index 000000000000..6db613291fae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResource.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class SubResource + { + /// + /// Initializes a new instance of the SubResource class. + /// + public SubResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResource class. + /// + /// Resource Id + public SubResource(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceReadOnly.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceReadOnly.cs new file mode 100644 index 000000000000..4bf2726f8ee8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceReadOnly.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class SubResourceReadOnly + { + /// + /// Initializes a new instance of the SubResourceReadOnly class. + /// + public SubResourceReadOnly() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResourceReadOnly class. + /// + /// Resource Id + public SubResourceReadOnly(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceWithColocationStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceWithColocationStatus.cs new file mode 100644 index 000000000000..e0b9d1f2304b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SubResourceWithColocationStatus.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class SubResourceWithColocationStatus : IResource + { + /// + /// Initializes a new instance of the SubResourceWithColocationStatus + /// class. + /// + public SubResourceWithColocationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResourceWithColocationStatus + /// class. + /// + /// Describes colocation status of a + /// resource in the Proximity Placement Group. + public SubResourceWithColocationStatus(InstanceViewStatus colocationStatus = default(InstanceViewStatus)) + { + ColocationStatus = colocationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes colocation status of a resource in the + /// Proximity Placement Group. + /// + [JsonProperty(PropertyName = "colocationStatus")] + public InstanceViewStatus ColocationStatus { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SupportedCapabilities.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SupportedCapabilities.cs new file mode 100644 index 000000000000..100a17891c83 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SupportedCapabilities.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// List of supported capabilities persisted on the disk resource for VM + /// use. + /// + public partial class SupportedCapabilities + { + /// + /// Initializes a new instance of the SupportedCapabilities class. + /// + public SupportedCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportedCapabilities class. + /// + /// The disk controllers that an OS + /// disk supports. If set it can be SCSI or SCSI, NVME or NVME, + /// SCSI. + /// True if the image from which the + /// OS disk is created supports accelerated networking. + /// CPU architecture supported by an OS + /// disk. Possible values include: 'x64', 'Arm64' + public SupportedCapabilities(string diskControllerTypes = default(string), bool? acceleratedNetwork = default(bool?), string architecture = default(string)) + { + DiskControllerTypes = diskControllerTypes; + AcceleratedNetwork = acceleratedNetwork; + Architecture = architecture; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk controllers that an OS disk supports. If set + /// it can be SCSI or SCSI, NVME or NVME, SCSI. + /// + [JsonProperty(PropertyName = "diskControllerTypes")] + public string DiskControllerTypes { get; set; } + + /// + /// Gets or sets true if the image from which the OS disk is created + /// supports accelerated networking. + /// + [JsonProperty(PropertyName = "acceleratedNetwork")] + public bool? AcceleratedNetwork { get; set; } + + /// + /// Gets or sets CPU architecture supported by an OS disk. Possible + /// values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "architecture")] + public string Architecture { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/SystemData.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..bbe7c8971855 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/SystemData.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The system meta data relating to this resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// Specifies the time in UTC at which the + /// Cloud Service (extended support) resource was created. <br + /// />Minimum api-version: 2022-04-04. + /// Specifies the time in UTC at which the + /// Cloud Service (extended support) resource was last modified. <br + /// />Minimum api-version: 2022-04-04. + public SystemData(System.DateTime? createdAt = default(System.DateTime?), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedAt = createdAt; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the time in UTC at which the Cloud Service (extended + /// support) resource was created. &lt;br /&gt;Minimum + /// api-version: 2022-04-04. + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; private set; } + + /// + /// Gets specifies the time in UTC at which the Cloud Service (extended + /// support) resource was last modified. &lt;br /&gt;Minimum + /// api-version: 2022-04-04. + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/TargetRegion.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/TargetRegion.cs new file mode 100644 index 000000000000..21dd08696630 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/TargetRegion.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the target region information. + /// + public partial class TargetRegion + { + /// + /// Initializes a new instance of the TargetRegion class. + /// + public TargetRegion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetRegion class. + /// + /// The name of the region. + /// The number of replicas of the + /// Image Version to be created per region. This property is + /// updatable. + /// Specifies the storage account type + /// to be used to store the image. This property is not updatable. + /// Possible values include: 'Standard_LRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// Contains the flag setting to hide + /// an image when users specify version='latest' + public TargetRegion(string name, int? regionalReplicaCount = default(int?), string storageAccountType = default(string), EncryptionImages encryption = default(EncryptionImages), bool? excludeFromLatest = default(bool?)) + { + Name = name; + RegionalReplicaCount = regionalReplicaCount; + StorageAccountType = storageAccountType; + Encryption = encryption; + ExcludeFromLatest = excludeFromLatest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the region. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of replicas of the Image Version to be + /// created per region. This property is updatable. + /// + [JsonProperty(PropertyName = "regionalReplicaCount")] + public int? RegionalReplicaCount { get; set; } + + /// + /// Gets or sets specifies the storage account type to be used to store + /// the image. This property is not updatable. Possible values include: + /// 'Standard_LRS', 'Standard_ZRS', 'Premium_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "encryption")] + public EncryptionImages Encryption { get; set; } + + /// + /// Gets or sets contains the flag setting to hide an image when users + /// specify version='latest' + /// + [JsonProperty(PropertyName = "excludeFromLatest")] + public bool? ExcludeFromLatest { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/TerminateNotificationProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/TerminateNotificationProfile.cs new file mode 100644 index 000000000000..734e97adc35a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/TerminateNotificationProfile.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class TerminateNotificationProfile + { + /// + /// Initializes a new instance of the TerminateNotificationProfile + /// class. + /// + public TerminateNotificationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TerminateNotificationProfile + /// class. + /// + /// Configurable length of time a + /// Virtual Machine being deleted will have to potentially approve the + /// Terminate Scheduled Event before the event is auto approved (timed + /// out). The configuration must be specified in ISO 8601 format, the + /// default value is 5 minutes (PT5M) + /// Specifies whether the Terminate Scheduled + /// event is enabled or disabled. + public TerminateNotificationProfile(string notBeforeTimeout = default(string), bool? enable = default(bool?)) + { + NotBeforeTimeout = notBeforeTimeout; + Enable = enable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets configurable length of time a Virtual Machine being + /// deleted will have to potentially approve the Terminate Scheduled + /// Event before the event is auto approved (timed out). The + /// configuration must be specified in ISO 8601 format, the default + /// value is 5 minutes (PT5M) + /// + [JsonProperty(PropertyName = "notBeforeTimeout")] + public string NotBeforeTimeout { get; set; } + + /// + /// Gets or sets specifies whether the Terminate Scheduled event is + /// enabled or disabled. + /// + [JsonProperty(PropertyName = "enable")] + public bool? Enable { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/ThrottledRequestsInput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/ThrottledRequestsInput.cs new file mode 100644 index 000000000000..969e1d214be4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/ThrottledRequestsInput.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// Api request input for LogAnalytics getThrottledRequests Api. + /// + public partial class ThrottledRequestsInput : LogAnalyticsInputBase + { + /// + /// Initializes a new instance of the ThrottledRequestsInput class. + /// + public ThrottledRequestsInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThrottledRequestsInput class. + /// + /// SAS Uri of the logging blob + /// container to which LogAnalytics Api writes output logs to. + /// From time of the query + /// To time of the query + /// Group query result by Throttle + /// Policy applied. + /// Group query result by Operation + /// Name. + /// Group query result by Resource + /// Name. + /// Group query result by + /// Client Application ID. + /// Group query result by User + /// Agent. + public ThrottledRequestsInput(string blobContainerSasUri, System.DateTime fromTime, System.DateTime toTime, bool? groupByThrottlePolicy = default(bool?), bool? groupByOperationName = default(bool?), bool? groupByResourceName = default(bool?), bool? groupByClientApplicationId = default(bool?), bool? groupByUserAgent = default(bool?)) + : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UefiSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UefiSettings.cs new file mode 100644 index 000000000000..bc34cfa01514 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UefiSettings.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the security settings like secure boot and vTPM used while + /// creating the virtual machine. Minimum api-version: 2020-12-01. + /// + public partial class UefiSettings + { + /// + /// Initializes a new instance of the UefiSettings class. + /// + public UefiSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UefiSettings class. + /// + /// Specifies whether secure boot + /// should be enabled on the virtual machine. Minimum api-version: + /// 2020-12-01. + /// Specifies whether vTPM should be enabled + /// on the virtual machine. Minimum api-version: 2020-12-01. + public UefiSettings(bool? secureBootEnabled = default(bool?), bool? vTpmEnabled = default(bool?)) + { + SecureBootEnabled = secureBootEnabled; + VTpmEnabled = vTpmEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether secure boot should be enabled on the + /// virtual machine. Minimum api-version: 2020-12-01. + /// + [JsonProperty(PropertyName = "secureBootEnabled")] + public bool? SecureBootEnabled { get; set; } + + /// + /// Gets or sets specifies whether vTPM should be enabled on the + /// virtual machine. Minimum api-version: 2020-12-01. + /// + [JsonProperty(PropertyName = "vTpmEnabled")] + public bool? VTpmEnabled { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateDomain.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateDomain.cs new file mode 100644 index 000000000000..a70bab5d5e0d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateDomain.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an update domain for the cloud service. + /// + public partial class UpdateDomain + { + /// + /// Initializes a new instance of the UpdateDomain class. + /// + public UpdateDomain() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateDomain class. + /// + /// Resource Id + /// Resource Name + public UpdateDomain(string id = default(string), string name = default(string)) + { + Id = id; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResource.cs new file mode 100644 index 000000000000..36966c4d5b76 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResource.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Update Resource model definition. + /// + public partial class UpdateResource + { + /// + /// Initializes a new instance of the UpdateResource class. + /// + public UpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResource class. + /// + /// Resource tags + public UpdateResource(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResourceDefinition.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResourceDefinition.cs new file mode 100644 index 000000000000..d6e03b654c5f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpdateResourceDefinition.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Update Resource model definition. + /// + public partial class UpdateResourceDefinition : IResource + { + /// + /// Initializes a new instance of the UpdateResourceDefinition class. + /// + public UpdateResourceDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResourceDefinition class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + public UpdateResourceDefinition(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeMode.cs new file mode 100644 index 000000000000..b68f7260974e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeMode.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeMode + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "Rolling")] + Rolling + } + internal static class UpgradeModeEnumExtension + { + internal static string ToSerializedValue(this UpgradeMode? value) + { + return value == null ? null : ((UpgradeMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeMode value) + { + switch( value ) + { + case UpgradeMode.Automatic: + return "Automatic"; + case UpgradeMode.Manual: + return "Manual"; + case UpgradeMode.Rolling: + return "Rolling"; + } + return null; + } + + internal static UpgradeMode? ParseUpgradeMode(this string value) + { + switch( value ) + { + case "Automatic": + return UpgradeMode.Automatic; + case "Manual": + return UpgradeMode.Manual; + case "Rolling": + return UpgradeMode.Rolling; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs new file mode 100644 index 000000000000..4abc3b68b679 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Virtual Machine Scale Set OS Upgrade History operation response. + /// + public partial class UpgradeOperationHistoricalStatusInfo + { + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfo class. + /// + public UpgradeOperationHistoricalStatusInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfo class. + /// + /// Information about the properties of the + /// upgrade operation. + /// Resource type + /// Resource location + public UpgradeOperationHistoricalStatusInfo(UpgradeOperationHistoricalStatusInfoProperties properties = default(UpgradeOperationHistoricalStatusInfoProperties), string type = default(string), string location = default(string)) + { + Properties = properties; + Type = type; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets information about the properties of the upgrade operation. + /// + [JsonProperty(PropertyName = "properties")] + public UpgradeOperationHistoricalStatusInfoProperties Properties { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs new file mode 100644 index 000000000000..9223ff4f85cb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes each OS upgrade on the Virtual Machine Scale Set. + /// + public partial class UpgradeOperationHistoricalStatusInfoProperties + { + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfoProperties class. + /// + public UpgradeOperationHistoricalStatusInfoProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpgradeOperationHistoricalStatusInfoProperties class. + /// + /// Information about the overall status of + /// the upgrade operation. + /// Counts of the VMs in each state. + /// Error Details for this upgrade if there are + /// any. + /// Invoker of the Upgrade Operation. Possible + /// values include: 'Unknown', 'User', 'Platform' + /// Image Reference details + /// Information about OS rollback if + /// performed + public UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryStatus runningStatus = default(UpgradeOperationHistoryStatus), RollingUpgradeProgressInfo progress = default(RollingUpgradeProgressInfo), ApiError error = default(ApiError), UpgradeOperationInvoker? startedBy = default(UpgradeOperationInvoker?), ImageReference targetImageReference = default(ImageReference), RollbackStatusInfo rollbackInfo = default(RollbackStatusInfo)) + { + RunningStatus = runningStatus; + Progress = progress; + Error = error; + StartedBy = startedBy; + TargetImageReference = targetImageReference; + RollbackInfo = rollbackInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets information about the overall status of the upgrade operation. + /// + [JsonProperty(PropertyName = "runningStatus")] + public UpgradeOperationHistoryStatus RunningStatus { get; private set; } + + /// + /// Gets counts of the VMs in each state. + /// + [JsonProperty(PropertyName = "progress")] + public RollingUpgradeProgressInfo Progress { get; private set; } + + /// + /// Gets error Details for this upgrade if there are any. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + /// + /// Gets invoker of the Upgrade Operation. Possible values include: + /// 'Unknown', 'User', 'Platform' + /// + [JsonProperty(PropertyName = "startedBy")] + public UpgradeOperationInvoker? StartedBy { get; private set; } + + /// + /// Gets image Reference details + /// + [JsonProperty(PropertyName = "targetImageReference")] + public ImageReference TargetImageReference { get; private set; } + + /// + /// Gets information about OS rollback if performed + /// + [JsonProperty(PropertyName = "rollbackInfo")] + public RollbackStatusInfo RollbackInfo { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoryStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoryStatus.cs new file mode 100644 index 000000000000..2cf34e000ae4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationHistoryStatus.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about the current running state of the overall upgrade. + /// + public partial class UpgradeOperationHistoryStatus + { + /// + /// Initializes a new instance of the UpgradeOperationHistoryStatus + /// class. + /// + public UpgradeOperationHistoryStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpgradeOperationHistoryStatus + /// class. + /// + /// Code indicating the current status of the + /// upgrade. Possible values include: 'RollingForward', 'Cancelled', + /// 'Completed', 'Faulted' + /// Start time of the upgrade. + /// End time of the upgrade. + public UpgradeOperationHistoryStatus(UpgradeState? code = default(UpgradeState?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?)) + { + Code = code; + StartTime = startTime; + EndTime = endTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets code indicating the current status of the upgrade. Possible + /// values include: 'RollingForward', 'Cancelled', 'Completed', + /// 'Faulted' + /// + [JsonProperty(PropertyName = "code")] + public UpgradeState? Code { get; private set; } + + /// + /// Gets start time of the upgrade. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets end time of the upgrade. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationInvoker.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationInvoker.cs new file mode 100644 index 000000000000..50decd99c59f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeOperationInvoker.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeOperationInvoker. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeOperationInvoker + { + [EnumMember(Value = "Unknown")] + Unknown, + [EnumMember(Value = "User")] + User, + [EnumMember(Value = "Platform")] + Platform + } + internal static class UpgradeOperationInvokerEnumExtension + { + internal static string ToSerializedValue(this UpgradeOperationInvoker? value) + { + return value == null ? null : ((UpgradeOperationInvoker)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeOperationInvoker value) + { + switch( value ) + { + case UpgradeOperationInvoker.Unknown: + return "Unknown"; + case UpgradeOperationInvoker.User: + return "User"; + case UpgradeOperationInvoker.Platform: + return "Platform"; + } + return null; + } + + internal static UpgradeOperationInvoker? ParseUpgradeOperationInvoker(this string value) + { + switch( value ) + { + case "Unknown": + return UpgradeOperationInvoker.Unknown; + case "User": + return UpgradeOperationInvoker.User; + case "Platform": + return UpgradeOperationInvoker.Platform; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradePolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradePolicy.cs new file mode 100644 index 000000000000..03e3f9eb4939 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradePolicy.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an upgrade policy - automatic, manual, or rolling. + /// + public partial class UpgradePolicy + { + /// + /// Initializes a new instance of the UpgradePolicy class. + /// + public UpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpgradePolicy class. + /// + /// Specifies the mode of an upgrade to virtual + /// machines in the scale set.<br /><br /> Possible values + /// are:<br /><br /> **Manual** - You control the + /// application of updates to virtual machines in the scale set. You do + /// this by using the manualUpgrade action.<br /><br /> + /// **Automatic** - All virtual machines in the scale set are + /// automatically updated at the same time. Possible values include: + /// 'Automatic', 'Manual', 'Rolling' + /// The configuration parameters + /// used while performing a rolling upgrade. + /// Configuration parameters + /// used for performing automatic OS Upgrade. + public UpgradePolicy(UpgradeMode? mode = default(UpgradeMode?), RollingUpgradePolicy rollingUpgradePolicy = default(RollingUpgradePolicy), AutomaticOSUpgradePolicy automaticOSUpgradePolicy = default(AutomaticOSUpgradePolicy)) + { + Mode = mode; + RollingUpgradePolicy = rollingUpgradePolicy; + AutomaticOSUpgradePolicy = automaticOSUpgradePolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mode of an upgrade to virtual machines + /// in the scale set.&lt;br /&gt;&lt;br /&gt; Possible + /// values are:&lt;br /&gt;&lt;br /&gt; **Manual** - + /// You control the application of updates to virtual machines in the + /// scale set. You do this by using the manualUpgrade action.&lt;br + /// /&gt;&lt;br /&gt; **Automatic** - All virtual machines + /// in the scale set are automatically updated at the same time. + /// Possible values include: 'Automatic', 'Manual', 'Rolling' + /// + [JsonProperty(PropertyName = "mode")] + public UpgradeMode? Mode { get; set; } + + /// + /// Gets or sets the configuration parameters used while performing a + /// rolling upgrade. + /// + [JsonProperty(PropertyName = "rollingUpgradePolicy")] + public RollingUpgradePolicy RollingUpgradePolicy { get; set; } + + /// + /// Gets or sets configuration parameters used for performing automatic + /// OS Upgrade. + /// + [JsonProperty(PropertyName = "automaticOSUpgradePolicy")] + public AutomaticOSUpgradePolicy AutomaticOSUpgradePolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RollingUpgradePolicy != null) + { + RollingUpgradePolicy.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeState.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeState.cs new file mode 100644 index 000000000000..24d3093b3803 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UpgradeState.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpgradeState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpgradeState + { + [EnumMember(Value = "RollingForward")] + RollingForward, + [EnumMember(Value = "Cancelled")] + Cancelled, + [EnumMember(Value = "Completed")] + Completed, + [EnumMember(Value = "Faulted")] + Faulted + } + internal static class UpgradeStateEnumExtension + { + internal static string ToSerializedValue(this UpgradeState? value) + { + return value == null ? null : ((UpgradeState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpgradeState value) + { + switch( value ) + { + case UpgradeState.RollingForward: + return "RollingForward"; + case UpgradeState.Cancelled: + return "Cancelled"; + case UpgradeState.Completed: + return "Completed"; + case UpgradeState.Faulted: + return "Faulted"; + } + return null; + } + + internal static UpgradeState? ParseUpgradeState(this string value) + { + switch( value ) + { + case "RollingForward": + return UpgradeState.RollingForward; + case "Cancelled": + return UpgradeState.Cancelled; + case "Completed": + return UpgradeState.Completed; + case "Faulted": + return UpgradeState.Faulted; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/Usage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/Usage.cs new file mode 100644 index 000000000000..20ec92fe5c68 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/Usage.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes Compute Resource Usage. + /// + public partial class Usage + { + /// + /// Initializes a new instance of the Usage class. + /// + public Usage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Usage class. + /// + /// The current usage of the + /// resource. + /// The maximum permitted usage of the + /// resource. + /// The name of the type of usage. + public Usage(int currentValue, long limit, UsageName name) + { + CurrentValue = currentValue; + Limit = limit; + Name = name; + CustomInit(); + } + /// + /// Static constructor for Usage class. + /// + static Usage() + { + Unit = "Count"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current usage of the resource. + /// + [JsonProperty(PropertyName = "currentValue")] + public int CurrentValue { get; set; } + + /// + /// Gets or sets the maximum permitted usage of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long Limit { get; set; } + + /// + /// Gets or sets the name of the type of usage. + /// + [JsonProperty(PropertyName = "name")] + public UsageName Name { get; set; } + + /// + /// An enum describing the unit of usage measurement. + /// + [JsonProperty(PropertyName = "unit")] + public static string Unit { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UsageName.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UsageName.cs new file mode 100644 index 000000000000..f7cd7d3ae483 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UsageName.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Usage Names. + /// + public partial class UsageName + { + /// + /// Initializes a new instance of the UsageName class. + /// + public UsageName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsageName class. + /// + /// The name of the resource. + /// The localized name of the + /// resource. + public UsageName(string value = default(string), string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the localized name of the resource. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactManage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactManage.cs new file mode 100644 index 000000000000..c071bf5d91f4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactManage.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class UserArtifactManage + { + /// + /// Initializes a new instance of the UserArtifactManage class. + /// + public UserArtifactManage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserArtifactManage class. + /// + /// Required. The path and arguments to install + /// the gallery application. This is limited to 4096 + /// characters. + /// Required. The path and arguments to remove the + /// gallery application. This is limited to 4096 characters. + /// Optional. The path and arguments to update the + /// gallery application. If not present, then update operation will + /// invoke remove command on the previous version and install command + /// on the current version of the gallery application. This is limited + /// to 4096 characters. + public UserArtifactManage(string install, string remove, string update = default(string)) + { + Install = install; + Remove = remove; + Update = update; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required. The path and arguments to install the + /// gallery application. This is limited to 4096 characters. + /// + [JsonProperty(PropertyName = "install")] + public string Install { get; set; } + + /// + /// Gets or sets required. The path and arguments to remove the gallery + /// application. This is limited to 4096 characters. + /// + [JsonProperty(PropertyName = "remove")] + public string Remove { get; set; } + + /// + /// Gets or sets optional. The path and arguments to update the gallery + /// application. If not present, then update operation will invoke + /// remove command on the previous version and install command on the + /// current version of the gallery application. This is limited to 4096 + /// characters. + /// + [JsonProperty(PropertyName = "update")] + public string Update { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Install == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Install"); + } + if (Remove == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Remove"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSettings.cs new file mode 100644 index 000000000000..7df0ba129ac8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSettings.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Additional settings for the VM app that contains the target package and + /// config file name when it is deployed to target VM or VM scale set. + /// + public partial class UserArtifactSettings + { + /// + /// Initializes a new instance of the UserArtifactSettings class. + /// + public UserArtifactSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserArtifactSettings class. + /// + /// Optional. The name to assign the + /// downloaded package file on the VM. This is limited to 4096 + /// characters. If not specified, the package file will be named the + /// same as the Gallery Application name. + /// Optional. The name to assign the + /// downloaded config file on the VM. This is limited to 4096 + /// characters. If not specified, the config file will be named the + /// Gallery Application name appended with "_config". + public UserArtifactSettings(string packageFileName = default(string), string configFileName = default(string)) + { + PackageFileName = packageFileName; + ConfigFileName = configFileName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional. The name to assign the downloaded package + /// file on the VM. This is limited to 4096 characters. If not + /// specified, the package file will be named the same as the Gallery + /// Application name. + /// + [JsonProperty(PropertyName = "packageFileName")] + public string PackageFileName { get; set; } + + /// + /// Gets or sets optional. The name to assign the downloaded config + /// file on the VM. This is limited to 4096 characters. If not + /// specified, the config file will be named the Gallery Application + /// name appended with "_config". + /// + [JsonProperty(PropertyName = "configFileName")] + public string ConfigFileName { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSource.cs new file mode 100644 index 000000000000..3af7ac1a8a5d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UserArtifactSource.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The source image from which the Image Version is going to be created. + /// + public partial class UserArtifactSource + { + /// + /// Initializes a new instance of the UserArtifactSource class. + /// + public UserArtifactSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserArtifactSource class. + /// + /// Required. The mediaLink of the artifact, + /// must be a readable storage page blob. + /// Optional. The + /// defaultConfigurationLink of the artifact, must be a readable + /// storage page blob. + public UserArtifactSource(string mediaLink, string defaultConfigurationLink = default(string)) + { + MediaLink = mediaLink; + DefaultConfigurationLink = defaultConfigurationLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required. The mediaLink of the artifact, must be a + /// readable storage page blob. + /// + [JsonProperty(PropertyName = "mediaLink")] + public string MediaLink { get; set; } + + /// + /// Gets or sets optional. The defaultConfigurationLink of the + /// artifact, must be a readable storage page blob. + /// + [JsonProperty(PropertyName = "defaultConfigurationLink")] + public string DefaultConfigurationLink { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MediaLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MediaLink"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/UserAssignedIdentitiesValue.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/UserAssignedIdentitiesValue.cs new file mode 100644 index 000000000000..54cb43c1bd6b --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/UserAssignedIdentitiesValue.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class UserAssignedIdentitiesValue + { + /// + /// Initializes a new instance of the UserAssignedIdentitiesValue + /// class. + /// + public UserAssignedIdentitiesValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentitiesValue + /// class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public UserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMDiskSecurityProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMDiskSecurityProfile.cs new file mode 100644 index 000000000000..f12f0bbb5daf --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMDiskSecurityProfile.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the security profile settings for the managed disk. **Note:** + /// It can only be set for Confidential VMs. + /// + public partial class VMDiskSecurityProfile + { + /// + /// Initializes a new instance of the VMDiskSecurityProfile class. + /// + public VMDiskSecurityProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMDiskSecurityProfile class. + /// + /// Specifies the EncryptionType + /// of the managed disk. It is set to DiskWithVMGuestState for + /// encryption of the managed disk along with VMGuestState blob, and + /// VMGuestStateOnly for encryption of just the VMGuestState blob. + /// **Note:** It can be set for only Confidential VMs. Possible values + /// include: 'VMGuestStateOnly', 'DiskWithVMGuestState' + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk that is used for + /// Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest + /// blob. + public VMDiskSecurityProfile(string securityEncryptionType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + { + SecurityEncryptionType = securityEncryptionType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the EncryptionType of the managed disk. It + /// is set to DiskWithVMGuestState for encryption of the managed disk + /// along with VMGuestState blob, and VMGuestStateOnly for encryption + /// of just the VMGuestState blob. **Note:** It can be set for only + /// Confidential VMs. Possible values include: 'VMGuestStateOnly', + /// 'DiskWithVMGuestState' + /// + [JsonProperty(PropertyName = "securityEncryptionType")] + public string SecurityEncryptionType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk that is used for Customer Managed + /// Key encrypted ConfidentialVM OS Disk and VMGuest blob. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGalleryApplication.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGalleryApplication.cs new file mode 100644 index 000000000000..5fbe6c6dfc01 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGalleryApplication.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the required information to reference a compute gallery + /// application version + /// + public partial class VMGalleryApplication + { + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + public VMGalleryApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMGalleryApplication class. + /// + /// Specifies the + /// GalleryApplicationVersion resource id on the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// Optional, Specifies a passthrough value for more + /// generic context. + /// Optional, Specifies the order in which the + /// packages have to be installed + /// Optional, Specifies the uri to + /// an azure blob that will replace the default configuration for the + /// package if provided + /// Optional, If true, + /// any failure for any operation in the VmApplication will fail the + /// deployment + /// If set to true, when a new + /// Gallery Application version is available in PIR/SIG, it will be + /// automatically updated for the VM/VMSS + public VMGalleryApplication(string packageReferenceId, string tags = default(string), int? order = default(int?), string configurationReference = default(string), bool? treatFailureAsDeploymentFailure = default(bool?), bool? enableAutomaticUpgrade = default(bool?)) + { + Tags = tags; + Order = order; + PackageReferenceId = packageReferenceId; + ConfigurationReference = configurationReference; + TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional, Specifies a passthrough value for more + /// generic context. + /// + [JsonProperty(PropertyName = "tags")] + public string Tags { get; set; } + + /// + /// Gets or sets optional, Specifies the order in which the packages + /// have to be installed + /// + [JsonProperty(PropertyName = "order")] + public int? Order { get; set; } + + /// + /// Gets or sets specifies the GalleryApplicationVersion resource id on + /// the form of + /// /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + /// + [JsonProperty(PropertyName = "packageReferenceId")] + public string PackageReferenceId { get; set; } + + /// + /// Gets or sets optional, Specifies the uri to an azure blob that will + /// replace the default configuration for the package if provided + /// + [JsonProperty(PropertyName = "configurationReference")] + public string ConfigurationReference { get; set; } + + /// + /// Gets or sets optional, If true, any failure for any operation in + /// the VmApplication will fail the deployment + /// + [JsonProperty(PropertyName = "treatFailureAsDeploymentFailure")] + public bool? TreatFailureAsDeploymentFailure { get; set; } + + /// + /// Gets or sets if set to true, when a new Gallery Application version + /// is available in PIR/SIG, it will be automatically updated for the + /// VM/VMSS + /// + [JsonProperty(PropertyName = "enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PackageReferenceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PackageReferenceId"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationLinux.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationLinux.cs new file mode 100644 index 000000000000..0cc53c8e44fc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationLinux.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VMGuestPatchClassificationLinux. + /// + public static class VMGuestPatchClassificationLinux + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string Other = "Other"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationWindows.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationWindows.cs new file mode 100644 index 000000000000..e98f65e64153 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchClassificationWindows.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VMGuestPatchClassificationWindows. + /// + public static class VMGuestPatchClassificationWindows + { + public const string Critical = "Critical"; + public const string Security = "Security"; + public const string UpdateRollUp = "UpdateRollUp"; + public const string FeaturePack = "FeaturePack"; + public const string ServicePack = "ServicePack"; + public const string Definition = "Definition"; + public const string Tools = "Tools"; + public const string Updates = "Updates"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootBehavior.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootBehavior.cs new file mode 100644 index 000000000000..87a76dded6d9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootBehavior.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VMGuestPatchRebootBehavior. + /// + public static class VMGuestPatchRebootBehavior + { + public const string Unknown = "Unknown"; + public const string NeverReboots = "NeverReboots"; + public const string AlwaysRequiresReboot = "AlwaysRequiresReboot"; + public const string CanRequestReboot = "CanRequestReboot"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootSetting.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootSetting.cs new file mode 100644 index 000000000000..ebfef92400a4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootSetting.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VMGuestPatchRebootSetting. + /// + public static class VMGuestPatchRebootSetting + { + public const string IfRequired = "IfRequired"; + public const string Never = "Never"; + public const string Always = "Always"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootStatus.cs new file mode 100644 index 000000000000..f9bf1a04138e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMGuestPatchRebootStatus.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VMGuestPatchRebootStatus. + /// + public static class VMGuestPatchRebootStatus + { + public const string Unknown = "Unknown"; + public const string NotNeeded = "NotNeeded"; + public const string Required = "Required"; + public const string Started = "Started"; + public const string Failed = "Failed"; + public const string Completed = "Completed"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs new file mode 100644 index 000000000000..b2955a8cb32d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMScaleSetConvertToSinglePlacementGroupInput.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class VMScaleSetConvertToSinglePlacementGroupInput + { + /// + /// Initializes a new instance of the + /// VMScaleSetConvertToSinglePlacementGroupInput class. + /// + public VMScaleSetConvertToSinglePlacementGroupInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VMScaleSetConvertToSinglePlacementGroupInput class. + /// + /// Id of the placement group in + /// which you want future virtual machine instances to be placed. To + /// query placement group Id, please use Virtual Machine Scale Set VMs + /// - Get API. If not provided, the platform will choose one with + /// maximum number of virtual machine instances. + public VMScaleSetConvertToSinglePlacementGroupInput(string activePlacementGroupId = default(string)) + { + ActivePlacementGroupId = activePlacementGroupId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the placement group in which you want future + /// virtual machine instances to be placed. To query placement group + /// Id, please use Virtual Machine Scale Set VMs - Get API. If not + /// provided, the platform will choose one with maximum number of + /// virtual machine instances. + /// + [JsonProperty(PropertyName = "activePlacementGroupId")] + public string ActivePlacementGroupId { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VMSizeProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VMSizeProperties.cs new file mode 100644 index 000000000000..5963fed3cae9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VMSizeProperties.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies VM Size Property settings on the virtual machine. + /// + public partial class VMSizeProperties + { + /// + /// Initializes a new instance of the VMSizeProperties class. + /// + public VMSizeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMSizeProperties class. + /// + /// Specifies the number of vCPUs + /// available for the VM. When this property is not specified in the + /// request body the default behavior is to set it to the value of + /// vCPUs available for that VM size exposed in api response of [List + /// all available virtual machine sizes in a + /// region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + /// Specifies the vCPU to physical core + /// ratio. When this property is not specified in the request body the + /// default behavior is set to the value of vCPUsPerCore for the VM + /// Size exposed in api response of [List all available virtual machine + /// sizes in a + /// region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + /// **Setting this property to 1 also means that hyper-threading is + /// disabled.** + public VMSizeProperties(int? vCPUsAvailable = default(int?), int? vCPUsPerCore = default(int?)) + { + VCPUsAvailable = vCPUsAvailable; + VCPUsPerCore = vCPUsPerCore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the number of vCPUs available for the VM. + /// When this property is not specified in the request body the default + /// behavior is to set it to the value of vCPUs available for that VM + /// size exposed in api response of [List all available virtual machine + /// sizes in a + /// region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + /// + [JsonProperty(PropertyName = "vCPUsAvailable")] + public int? VCPUsAvailable { get; set; } + + /// + /// Gets or sets specifies the vCPU to physical core ratio. When this + /// property is not specified in the request body the default behavior + /// is set to the value of vCPUsPerCore for the VM Size exposed in api + /// response of [List all available virtual machine sizes in a + /// region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + /// **Setting this property to 1 also means that hyper-threading is + /// disabled.** + /// + [JsonProperty(PropertyName = "vCPUsPerCore")] + public int? VCPUsPerCore { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VaultCertificate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VaultCertificate.cs new file mode 100644 index 000000000000..a2da70a8a3cb --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VaultCertificate.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a single certificate reference in a Key Vault, and where the + /// certificate should reside on the VM. + /// + public partial class VaultCertificate + { + /// + /// Initializes a new instance of the VaultCertificate class. + /// + public VaultCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultCertificate class. + /// + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. For adding a secret to + /// the Key Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// <br><br> {<br> + /// "data":"<Base64-encoded-certificate>",<br> + /// "dataType":"pfx",<br> + /// "password":"<pfx-file-password>"<br>} <br> To + /// install certificates on a virtual machine it is recommended to use + /// the [Azure Key Vault virtual machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// For Windows VMs, specifies the + /// certificate store on the Virtual Machine to which the certificate + /// should be added. The specified certificate store is implicitly in + /// the LocalMachine account. For Linux VMs, the certificate file is + /// placed under the /var/lib/waagent directory, with the file name + /// &lt;UppercaseThumbprint&gt;.crt for the X509 certificate + /// file and &lt;UppercaseThumbprint&gt;.prv for private key. + /// Both of these files are .pem formatted. + public VaultCertificate(string certificateUrl = default(string), string certificateStore = default(string)) + { + CertificateUrl = certificateUrl; + CertificateStore = certificateStore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. For adding a secret to the Key + /// Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// &lt;br&gt;&lt;br&gt; {&lt;br&gt; + /// "data":"&lt;Base64-encoded-certificate&gt;",&lt;br&gt; + /// "dataType":"pfx",&lt;br&gt; + /// "password":"&lt;pfx-file-password&gt;"&lt;br&gt;} + /// &lt;br&gt; To install certificates on a virtual machine it + /// is recommended to use the [Azure Key Vault virtual machine + /// extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + /// + /// Gets or sets for Windows VMs, specifies the certificate store on + /// the Virtual Machine to which the certificate should be added. The + /// specified certificate store is implicitly in the LocalMachine + /// account. For Linux VMs, the certificate file is placed under the + /// /var/lib/waagent directory, with the file name + /// &amp;lt;UppercaseThumbprint&amp;gt;.crt for the X509 + /// certificate file and + /// &amp;lt;UppercaseThumbprint&amp;gt;.prv for private key. + /// Both of these files are .pem formatted. + /// + [JsonProperty(PropertyName = "certificateStore")] + public string CertificateStore { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VaultSecretGroup.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VaultSecretGroup.cs new file mode 100644 index 000000000000..059934972a21 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VaultSecretGroup.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a set of certificates which are all in the same Key Vault. + /// + public partial class VaultSecretGroup + { + /// + /// Initializes a new instance of the VaultSecretGroup class. + /// + public VaultSecretGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSecretGroup class. + /// + /// The relative URL of the Key Vault + /// containing all of the certificates in VaultCertificates. + /// The list of key vault references in + /// SourceVault which contain certificates. + public VaultSecretGroup(SubResource sourceVault = default(SubResource), IList vaultCertificates = default(IList)) + { + SourceVault = sourceVault; + VaultCertificates = vaultCertificates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the relative URL of the Key Vault containing all of + /// the certificates in VaultCertificates. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Gets or sets the list of key vault references in SourceVault which + /// contain certificates. + /// + [JsonProperty(PropertyName = "vaultCertificates")] + public IList VaultCertificates { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualHardDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualHardDisk.cs new file mode 100644 index 000000000000..5434e0ff26be --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualHardDisk.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the uri of a disk. + /// + public partial class VirtualHardDisk + { + /// + /// Initializes a new instance of the VirtualHardDisk class. + /// + public VirtualHardDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualHardDisk class. + /// + /// Specifies the virtual hard disk's uri. + public VirtualHardDisk(string uri = default(string)) + { + Uri = uri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the virtual hard disk's uri. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachine.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachine.cs new file mode 100644 index 000000000000..3105715b23c9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachine.cs @@ -0,0 +1,507 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachine : Resource + { + /// + /// Initializes a new instance of the VirtualMachine class. + /// + public VirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachine class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. Minimum api-version: 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. The availability set to which the VM is being added should be + /// under the same resource group as the availability set resource. An + /// existing VM cannot be added to an availability set. This property + /// cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. This property cannot exist along with a + /// non-null properties.availabilitySet reference. Minimum api‐version: + /// 2019‐03‐01. + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. Minimum api-version: 2018-04-01. + /// Specifies the priority for the virtual + /// machine. Minimum api-version: 2019-03-01. Possible values include: + /// 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. For Azure Spot + /// virtual machines, both 'Deallocate' and 'Delete' are supported and + /// the minimum api-version is 2019-03-01. For Azure Spot scale sets, + /// both 'Deallocate' and 'Delete' are supported and the minimum + /// api-version is 2017-10-30-preview. Possible values include: + /// 'Deallocate', 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. Minimum api-version: + /// 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. Minimum api-version: + /// 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. **Note:** User + /// cannot specify both host and hostGroup properties. Minimum + /// api-version: 2020-06-01. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains. This is applicable only if the 'virtualMachineScaleSet' + /// property of this Virtual Machine is set. The Virtual Machine Scale + /// Set that is referenced, must have 'platformFaultDomainCount' + /// greater than 1. This property cannot be updated once the Virtual + /// Machine is created. Fault domain assignment can be viewed in the + /// Virtual Machine Instance View. Minimum api‐version: + /// 2020‐12‐01. + /// Specifies Scheduled Event + /// related configurations. + /// UserData for the VM, which must be base-64 + /// encoded. Customer should not pass any secrets in here. Minimum + /// api-version: 2021-03-01. + /// Specifies information about the + /// capacity reservation that is used to allocate virtual machine. + /// Minimum api-version: 2021-04-01. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS. + /// Specifies the time at which the Virtual + /// Machine resource was created. Minimum api-version: + /// 2021-11-01. + /// The virtual machine child extension + /// resources. + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + /// The extended location of the Virtual + /// Machine. + public VirtualMachine(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), int? platformFaultDomain = default(int?), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile), string userData = default(string), CapacityReservationProfile capacityReservation = default(CapacityReservationProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), System.DateTime? timeCreated = default(System.DateTime?), IList resources = default(IList), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + TimeCreated = timeCreated; + Resources = resources; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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 -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings used while + /// creating the virtual machine. Some of the settings cannot be + /// changed once VM is provisioned. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. Minimum + /// api-version: 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. The availability set to which the VM is being added should be + /// under the same resource group as the availability set resource. An + /// existing VM cannot be added to an availability set. This property + /// cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { get; set; } + + /// + /// Gets or sets specifies information about the virtual machine scale + /// set that the virtual machine should be assigned to. Virtual + /// machines specified in the same virtual machine scale set are + /// allocated to different nodes to maximize availability. Currently, a + /// VM can only be added to virtual machine scale set at creation time. + /// An existing VM cannot be added to a virtual machine scale set. This + /// property cannot exist along with a non-null + /// properties.availabilitySet reference. Minimum api‐version: + /// 2019‐03‐01. + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSet")] + public SubResource VirtualMachineScaleSet { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine should be assigned to. Minimum + /// api-version: 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machine. + /// Minimum api-version: 2019-03-01. Possible values include: + /// 'Regular', 'Low', 'Spot' + /// + [JsonProperty(PropertyName = "properties.priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "properties.evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// virtual machine. Minimum api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "properties.billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host that + /// the virtual machine resides in. Minimum api-version: 2018-10-01. + /// + [JsonProperty(PropertyName = "properties.host")] + public SubResource Host { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine resides in. **Note:** User cannot specify + /// both host and hostGroup properties. Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies that the image or disk that is being used + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: + /// &lt;br&gt;&lt;br&gt; Windows_Client + /// &lt;br&gt;&lt;br&gt; Windows_Server + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies the VM unique ID which is a 128-bits identifier that + /// is encoded and stored in all Azure IaaS VMs SMBIOS and can be read + /// using platform BIOS commands. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault domains. This is + /// applicable only if the 'virtualMachineScaleSet' property of this + /// Virtual Machine is set. The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' greater than 1. + /// This property cannot be updated once the Virtual Machine is + /// created. Fault domain assignment can be viewed in the Virtual + /// Machine Instance View. Minimum api‐version: 2020‐12‐01. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "properties.scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + /// + /// Gets or sets userData for the VM, which must be base-64 encoded. + /// Customer should not pass any secrets in here. Minimum api-version: + /// 2021-03-01. + /// + [JsonProperty(PropertyName = "properties.userData")] + public string UserData { get; set; } + + /// + /// Gets or sets specifies information about the capacity reservation + /// that is used to allocate virtual machine. Minimum api-version: + /// 2021-04-01. + /// + [JsonProperty(PropertyName = "properties.capacityReservation")] + public CapacityReservationProfile CapacityReservation { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS. + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets specifies the time at which the Virtual Machine resource was + /// created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets the virtual machine child extension resources. + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + /// + /// Gets or sets the identity of the virtual machine, if configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + if (Resources != null) + { + foreach (var element in Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAgentInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAgentInstanceView.cs new file mode 100644 index 000000000000..2399739f2cfd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAgentInstanceView.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of the VM Agent running on the virtual machine. + /// + public partial class VirtualMachineAgentInstanceView + { + /// + /// Initializes a new instance of the VirtualMachineAgentInstanceView + /// class. + /// + public VirtualMachineAgentInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineAgentInstanceView + /// class. + /// + /// The VM Agent full version. + /// The virtual machine extension + /// handler instance view. + /// The resource status information. + public VirtualMachineAgentInstanceView(string vmAgentVersion = default(string), IList extensionHandlers = default(IList), IList statuses = default(IList)) + { + VmAgentVersion = vmAgentVersion; + ExtensionHandlers = extensionHandlers; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the VM Agent full version. + /// + [JsonProperty(PropertyName = "vmAgentVersion")] + public string VmAgentVersion { get; set; } + + /// + /// Gets or sets the virtual machine extension handler instance view. + /// + [JsonProperty(PropertyName = "extensionHandlers")] + public IList ExtensionHandlers { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAssessPatchesResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAssessPatchesResult.cs new file mode 100644 index 000000000000..9bb2a7c3e50c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineAssessPatchesResult.cs @@ -0,0 +1,138 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the properties of an AssessPatches result. + /// + public partial class VirtualMachineAssessPatchesResult + { + /// + /// Initializes a new instance of the VirtualMachineAssessPatchesResult + /// class. + /// + public VirtualMachineAssessPatchesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineAssessPatchesResult + /// class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the operation + /// that produced this result. It is used to correlate across CRP and + /// extension logs. + /// The overall reboot status of the VM. It + /// will be true when partially installed patches require a reboot to + /// complete installation but the reboot has not yet occurred. + /// The number of critical + /// or security patches that have been detected as available and not + /// yet installed. + /// The number of all available patches + /// excluding critical and security. + /// The UTC timestamp when the operation + /// began. + /// The list of patches that have been + /// detected as available for installation. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public VirtualMachineAssessPatchesResult(string status = default(string), string assessmentActivityId = default(string), bool? rebootPending = default(bool?), int? criticalAndSecurityPatchCount = default(int?), int? otherPatchCount = default(int?), System.DateTime? startDateTime = default(System.DateTime?), IList availablePatches = default(IList), ApiError error = default(ApiError)) + { + Status = status; + AssessmentActivityId = assessmentActivityId; + RebootPending = rebootPending; + CriticalAndSecurityPatchCount = criticalAndSecurityPatchCount; + OtherPatchCount = otherPatchCount; + StartDateTime = startDateTime; + AvailablePatches = availablePatches; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Unknown", "Failed", "Succeeded", or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "assessmentActivityId")] + public string AssessmentActivityId { get; private set; } + + /// + /// Gets the overall reboot status of the VM. It will be true when + /// partially installed patches require a reboot to complete + /// installation but the reboot has not yet occurred. + /// + [JsonProperty(PropertyName = "rebootPending")] + public bool? RebootPending { get; private set; } + + /// + /// Gets the number of critical or security patches that have been + /// detected as available and not yet installed. + /// + [JsonProperty(PropertyName = "criticalAndSecurityPatchCount")] + public int? CriticalAndSecurityPatchCount { get; private set; } + + /// + /// Gets the number of all available patches excluding critical and + /// security. + /// + [JsonProperty(PropertyName = "otherPatchCount")] + public int? OtherPatchCount { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; private set; } + + /// + /// Gets the list of patches that have been detected as available for + /// installation. + /// + [JsonProperty(PropertyName = "availablePatches")] + public IList AvailablePatches { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureParameters.cs new file mode 100644 index 000000000000..4abdc0fbe1dd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureParameters.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Capture Virtual Machine parameters. + /// + public partial class VirtualMachineCaptureParameters + { + /// + /// Initializes a new instance of the VirtualMachineCaptureParameters + /// class. + /// + public VirtualMachineCaptureParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineCaptureParameters + /// class. + /// + /// The captured virtual hard disk's name + /// prefix. + /// The destination container + /// name. + /// Specifies whether to overwrite the + /// destination virtual hard disk, in case of conflict. + public VirtualMachineCaptureParameters(string vhdPrefix, string destinationContainerName, bool overwriteVhds) + { + VhdPrefix = vhdPrefix; + DestinationContainerName = destinationContainerName; + OverwriteVhds = overwriteVhds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the captured virtual hard disk's name prefix. + /// + [JsonProperty(PropertyName = "vhdPrefix")] + public string VhdPrefix { get; set; } + + /// + /// Gets or sets the destination container name. + /// + [JsonProperty(PropertyName = "destinationContainerName")] + public string DestinationContainerName { get; set; } + + /// + /// Gets or sets specifies whether to overwrite the destination virtual + /// hard disk, in case of conflict. + /// + [JsonProperty(PropertyName = "overwriteVhds")] + public bool OverwriteVhds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VhdPrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VhdPrefix"); + } + if (DestinationContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationContainerName"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureResult.cs new file mode 100644 index 000000000000..a99ef8504432 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineCaptureResult.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Output of virtual machine capture operation. + /// + public partial class VirtualMachineCaptureResult : IResource + { + /// + /// Initializes a new instance of the VirtualMachineCaptureResult + /// class. + /// + public VirtualMachineCaptureResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineCaptureResult + /// class. + /// + /// the schema of the captured virtual + /// machine + /// the version of the content + /// parameters of the captured virtual + /// machine + /// a list of resource items of the captured + /// virtual machine + public VirtualMachineCaptureResult(string schema = default(string), string contentVersion = default(string), object parameters = default(object), IList resources = default(IList)) + { + Schema = schema; + ContentVersion = contentVersion; + Parameters = parameters; + Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the schema of the captured virtual machine + /// + [JsonProperty(PropertyName = "$schema")] + public string Schema { get; private set; } + + /// + /// Gets the version of the content + /// + [JsonProperty(PropertyName = "contentVersion")] + public string ContentVersion { get; private set; } + + /// + /// Gets parameters of the captured virtual machine + /// + [JsonProperty(PropertyName = "parameters")] + public object Parameters { get; private set; } + + /// + /// Gets a list of resource items of the captured virtual machine + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineEvictionPolicyTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineEvictionPolicyTypes.cs new file mode 100644 index 000000000000..94370101fd0c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineEvictionPolicyTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachineEvictionPolicyTypes. + /// + public static class VirtualMachineEvictionPolicyTypes + { + public const string Deallocate = "Deallocate"; + public const string Delete = "Delete"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtension.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtension.cs new file mode 100644 index 000000000000..68a90a583cb7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtension.cs @@ -0,0 +1,206 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtension : ResourceWithOptionalLocation + { + /// + /// Initializes a new instance of the VirtualMachineExtension class. + /// + public VirtualMachineExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtension class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the + /// extension; an example is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine extension instance + /// view. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + /// Collection of extension + /// names after which this extension needs to be provisioned. + public VirtualMachineExtension(string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string forceUpdateTag = default(string), string publisher = default(string), string virtualMachineExtensionType = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference), IList provisionAfterExtensions = default(IList)) + : base(location, id, name, type, tags) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + VirtualMachineExtensionType = virtualMachineExtensionType; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + ProvisionAfterExtensions = provisionAfterExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string VirtualMachineExtensionType { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the virtual machine extension instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineExtensionInstanceView InstanceView { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Gets or sets collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs new file mode 100644 index 000000000000..ba3f55442e06 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The instance view of a virtual machine extension handler. + /// + public partial class VirtualMachineExtensionHandlerInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionHandlerInstanceView class. + /// + public VirtualMachineExtensionHandlerInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionHandlerInstanceView class. + /// + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// The extension handler status. + public VirtualMachineExtensionHandlerInstanceView(string type = default(string), string typeHandlerVersion = default(string), InstanceViewStatus status = default(InstanceViewStatus)) + { + Type = type; + TypeHandlerVersion = typeHandlerVersion; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets the extension handler status. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionImage.cs new file mode 100644 index 000000000000..a402046384be --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionImage.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Extension Image. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtensionImage : Resource + { + /// + /// Initializes a new instance of the VirtualMachineExtensionImage + /// class. + /// + public VirtualMachineExtensionImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtensionImage + /// class. + /// + /// Resource location + /// The operating system this extension + /// supports. + /// The type of role (IaaS or PaaS) this + /// extension supports. + /// The schema defined by publisher, where + /// extension consumers should provide settings in a matching + /// schema. + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Whether the extension can be used + /// on xRP VMScaleSets. By default existing extensions are usable on + /// scalesets, but there might be cases where a publisher wants to + /// explicitly indicate the extension is only enabled for CRP VMs but + /// not VMSS. + /// Whether the handler can + /// support multiple extensions. + public VirtualMachineExtensionImage(string location, string operatingSystem, string computeRole, string handlerSchema, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), bool? vmScaleSetEnabled = default(bool?), bool? supportsMultipleExtensions = default(bool?)) + : base(location, id, name, type, tags) + { + OperatingSystem = operatingSystem; + ComputeRole = computeRole; + HandlerSchema = handlerSchema; + VmScaleSetEnabled = vmScaleSetEnabled; + SupportsMultipleExtensions = supportsMultipleExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operating system this extension supports. + /// + [JsonProperty(PropertyName = "properties.operatingSystem")] + public string OperatingSystem { get; set; } + + /// + /// Gets or sets the type of role (IaaS or PaaS) this extension + /// supports. + /// + [JsonProperty(PropertyName = "properties.computeRole")] + public string ComputeRole { get; set; } + + /// + /// Gets or sets the schema defined by publisher, where extension + /// consumers should provide settings in a matching schema. + /// + [JsonProperty(PropertyName = "properties.handlerSchema")] + public string HandlerSchema { get; set; } + + /// + /// Gets or sets whether the extension can be used on xRP VMScaleSets. + /// By default existing extensions are usable on scalesets, but there + /// might be cases where a publisher wants to explicitly indicate the + /// extension is only enabled for CRP VMs but not VMSS. + /// + [JsonProperty(PropertyName = "properties.vmScaleSetEnabled")] + public bool? VmScaleSetEnabled { get; set; } + + /// + /// Gets or sets whether the handler can support multiple extensions. + /// + [JsonProperty(PropertyName = "properties.supportsMultipleExtensions")] + public bool? SupportsMultipleExtensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (OperatingSystem == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatingSystem"); + } + if (ComputeRole == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ComputeRole"); + } + if (HandlerSchema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HandlerSchema"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionInstanceView.cs new file mode 100644 index 000000000000..2104b94125d7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionInstanceView.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a virtual machine extension. + /// + public partial class VirtualMachineExtensionInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionInstanceView class. + /// + public VirtualMachineExtensionInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionInstanceView class. + /// + /// The virtual machine extension name. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// The resource status information. + /// The resource status information. + public VirtualMachineExtensionInstanceView(string name = default(string), string type = default(string), string typeHandlerVersion = default(string), IList substatuses = default(IList), IList statuses = default(IList)) + { + Name = name; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + Substatuses = substatuses; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine extension name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "substatuses")] + public IList Substatuses { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionUpdate.cs new file mode 100644 index 000000000000..64a288bbcffc --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionUpdate.cs @@ -0,0 +1,176 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineExtensionUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineExtensionUpdate + /// class. + /// + public VirtualMachineExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineExtensionUpdate + /// class. + /// + /// Resource tags + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + public VirtualMachineExtensionUpdate(IDictionary tags = default(IDictionary), string forceUpdateTag = default(string), string publisher = default(string), string type = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(tags) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionsListResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionsListResult.cs new file mode 100644 index 000000000000..b499926d72ac --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineExtensionsListResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The List Extension operation response + /// + public partial class VirtualMachineExtensionsListResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionsListResult class. + /// + public VirtualMachineExtensionsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineExtensionsListResult class. + /// + /// The list of extensions + public VirtualMachineExtensionsListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of extensions + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineHealthStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineHealthStatus.cs new file mode 100644 index 000000000000..76ab1b356e58 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineHealthStatus.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The health status of the VM. + /// + public partial class VirtualMachineHealthStatus + { + /// + /// Initializes a new instance of the VirtualMachineHealthStatus class. + /// + public VirtualMachineHealthStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineHealthStatus class. + /// + /// The health status information for the + /// VM. + public VirtualMachineHealthStatus(InstanceViewStatus status = default(InstanceViewStatus)) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the health status information for the VM. + /// + [JsonProperty(PropertyName = "status")] + public InstanceViewStatus Status { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIdentity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIdentity.cs new file mode 100644 index 000000000000..80061786b2ae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIdentity.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Identity for the virtual machine. + /// + public partial class VirtualMachineIdentity + { + /// + /// Initializes a new instance of the VirtualMachineIdentity class. + /// + public VirtualMachineIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineIdentity class. + /// + /// The principal id of virtual machine + /// identity. This property will only be provided for a system assigned + /// identity. + /// The tenant id associated with the virtual + /// machine. This property will only be provided for a system assigned + /// identity. + /// The type of identity used for the virtual + /// machine. The type 'SystemAssigned, UserAssigned' includes both an + /// implicitly created identity and a set of user assigned identities. + /// The type 'None' will remove any identities from the virtual + /// machine. Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned, UserAssigned', 'None' + /// The list of user identities + /// associated with the Virtual Machine. The user identity dictionary + /// key references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public VirtualMachineIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of virtual machine identity. This property + /// will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id associated with the virtual machine. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the type of identity used for the virtual machine. The + /// type 'SystemAssigned, UserAssigned' includes both an implicitly + /// created identity and a set of user assigned identities. The type + /// 'None' will remove any identities from the virtual machine. + /// Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the + /// Virtual Machine. The user identity dictionary key references will + /// be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImage.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImage.cs new file mode 100644 index 000000000000..ab60c6ad93e2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImage.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Image. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineImage : VirtualMachineImageResource + { + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + public VirtualMachineImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + /// The name of the resource. + /// The supported Azure location of the + /// resource. + /// Resource Id + /// 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). + /// The extended location of the Virtual + /// Machine. + /// Possible values include: 'V1', + /// 'V2' + /// Specifies disallowed configuration for the + /// VirtualMachine created from the image + /// Possible values include: 'x64', + /// 'Arm64' + public VirtualMachineImage(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), PurchasePlan plan = default(PurchasePlan), OSDiskImage osDiskImage = default(OSDiskImage), IList dataDiskImages = default(IList), AutomaticOSUpgradeProperties automaticOSUpgradeProperties = default(AutomaticOSUpgradeProperties), string hyperVGeneration = default(string), DisallowedConfiguration disallowed = default(DisallowedConfiguration), IList features = default(IList), string architecture = default(string), ImageDeprecationStatus imageDeprecationStatus = default(ImageDeprecationStatus)) + : base(name, location, id, tags, extendedLocation) + { + Plan = plan; + OsDiskImage = osDiskImage; + DataDiskImages = dataDiskImages; + AutomaticOSUpgradeProperties = automaticOSUpgradeProperties; + HyperVGeneration = hyperVGeneration; + Disallowed = disallowed; + Features = features; + Architecture = architecture; + ImageDeprecationStatus = imageDeprecationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.plan")] + public PurchasePlan Plan { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.osDiskImage")] + public OSDiskImage OsDiskImage { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.dataDiskImages")] + public IList DataDiskImages { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.automaticOSUpgradeProperties")] + public AutomaticOSUpgradeProperties AutomaticOSUpgradeProperties { get; set; } + + /// + /// Gets or sets possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "properties.hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets specifies disallowed configuration for the + /// VirtualMachine created from the image + /// + [JsonProperty(PropertyName = "properties.disallowed")] + public DisallowedConfiguration Disallowed { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.features")] + public IList Features { get; set; } + + /// + /// Gets or sets possible values include: 'x64', 'Arm64' + /// + [JsonProperty(PropertyName = "properties.architecture")] + public string Architecture { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.imageDeprecationStatus")] + public ImageDeprecationStatus ImageDeprecationStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Plan != null) + { + Plan.Validate(); + } + if (OsDiskImage != null) + { + OsDiskImage.Validate(); + } + if (AutomaticOSUpgradeProperties != null) + { + AutomaticOSUpgradeProperties.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageFeature.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageFeature.cs new file mode 100644 index 000000000000..5b38dfe6711a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageFeature.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies additional capabilities supported by the image + /// + public partial class VirtualMachineImageFeature + { + /// + /// Initializes a new instance of the VirtualMachineImageFeature class. + /// + public VirtualMachineImageFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImageFeature class. + /// + /// The name of the feature. + /// The corresponding value for the + /// feature. + public VirtualMachineImageFeature(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the corresponding value for the feature. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageResource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageResource.cs new file mode 100644 index 000000000000..f7adc3819051 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineImageResource.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Virtual machine image resource information. + /// + public partial class VirtualMachineImageResource : SubResource + { + /// + /// Initializes a new instance of the VirtualMachineImageResource + /// class. + /// + public VirtualMachineImageResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImageResource + /// class. + /// + /// The name of the resource. + /// The supported Azure location of the + /// resource. + /// Resource Id + /// 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). + /// The extended location of the Virtual + /// Machine. + public VirtualMachineImageResource(string name, string location, string id = default(string), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(id) + { + Name = name; + Location = location; + Tags = tags; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the supported Azure location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets 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). + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesParameters.cs new file mode 100644 index 000000000000..8b461cf4c849 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesParameters.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input for InstallPatches as directly received by the API + /// + public partial class VirtualMachineInstallPatchesParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + public VirtualMachineInstallPatchesParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesParameters class. + /// + /// Defines when it is acceptable to reboot + /// a VM during a software update operation. Possible values include: + /// 'IfRequired', 'Never', 'Always' + /// Specifies the maximum amount of time + /// that the operation will run. It must be an ISO 8601-compliant + /// duration string such as PT4H (4 hours) + /// Input for InstallPatches on a + /// Windows VM, as directly received by the API + /// Input for InstallPatches on a Linux + /// VM, as directly received by the API + public VirtualMachineInstallPatchesParameters(string rebootSetting, string maximumDuration = default(string), WindowsParameters windowsParameters = default(WindowsParameters), LinuxParameters linuxParameters = default(LinuxParameters)) + { + MaximumDuration = maximumDuration; + RebootSetting = rebootSetting; + WindowsParameters = windowsParameters; + LinuxParameters = linuxParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the maximum amount of time that the + /// operation will run. It must be an ISO 8601-compliant duration + /// string such as PT4H (4 hours) + /// + [JsonProperty(PropertyName = "maximumDuration")] + public string MaximumDuration { get; set; } + + /// + /// Gets or sets defines when it is acceptable to reboot a VM during a + /// software update operation. Possible values include: 'IfRequired', + /// 'Never', 'Always' + /// + [JsonProperty(PropertyName = "rebootSetting")] + public string RebootSetting { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Windows VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "windowsParameters")] + public WindowsParameters WindowsParameters { get; set; } + + /// + /// Gets or sets input for InstallPatches on a Linux VM, as directly + /// received by the API + /// + [JsonProperty(PropertyName = "linuxParameters")] + public LinuxParameters LinuxParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RebootSetting == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RebootSetting"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesResult.cs new file mode 100644 index 000000000000..53d2c65fe027 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstallPatchesResult.cs @@ -0,0 +1,179 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The result summary of an installation operation. + /// + public partial class VirtualMachineInstallPatchesResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + public VirtualMachineInstallPatchesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineInstallPatchesResult class. + /// + /// The overall success or failure status of the + /// operation. It remains "InProgress" until the operation completes. + /// At that point it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', + /// 'CompletedWithWarnings' + /// The activity ID of the + /// operation that produced this result. It is used to correlate across + /// CRP and extension logs. + /// The reboot state of the VM following + /// completion of the operation. Possible values include: 'Unknown', + /// 'NotNeeded', 'Required', 'Started', 'Failed', 'Completed' + /// Whether the operation ran + /// out of time before it completed all its intended actions. + /// The number of patches that were + /// not installed due to the user blocking their installation. + /// The number of patches that were + /// detected as available for install, but did not meet the operation's + /// criteria. + /// The number of patches that were + /// identified as meeting the installation criteria, but were not able + /// to be installed. Typically this happens when + /// maintenanceWindowExceeded == true. + /// The number of patches + /// successfully installed. + /// The number of patches that could not + /// be installed due to some issue. See errors for details. + /// The patches that were installed during the + /// operation. + /// The UTC timestamp when the operation + /// began. + /// The errors that were encountered during + /// execution of the operation. The details array contains the list of + /// them. + public VirtualMachineInstallPatchesResult(string status = default(string), string installationActivityId = default(string), string rebootStatus = default(string), bool? maintenanceWindowExceeded = default(bool?), int? excludedPatchCount = default(int?), int? notSelectedPatchCount = default(int?), int? pendingPatchCount = default(int?), int? installedPatchCount = default(int?), int? failedPatchCount = default(int?), IList patches = default(IList), System.DateTime? startDateTime = default(System.DateTime?), ApiError error = default(ApiError)) + { + Status = status; + InstallationActivityId = installationActivityId; + RebootStatus = rebootStatus; + MaintenanceWindowExceeded = maintenanceWindowExceeded; + ExcludedPatchCount = excludedPatchCount; + NotSelectedPatchCount = notSelectedPatchCount; + PendingPatchCount = pendingPatchCount; + InstalledPatchCount = installedPatchCount; + FailedPatchCount = failedPatchCount; + Patches = patches; + StartDateTime = startDateTime; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the overall success or failure status of the operation. It + /// remains "InProgress" until the operation completes. At that point + /// it will become "Failed", "Succeeded", "Unknown" or + /// "CompletedWithWarnings.". Possible values include: 'Unknown', + /// 'InProgress', 'Failed', 'Succeeded', 'CompletedWithWarnings' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "installationActivityId")] + public string InstallationActivityId { get; private set; } + + /// + /// Gets the reboot state of the VM following completion of the + /// operation. Possible values include: 'Unknown', 'NotNeeded', + /// 'Required', 'Started', 'Failed', 'Completed' + /// + [JsonProperty(PropertyName = "rebootStatus")] + public string RebootStatus { get; private set; } + + /// + /// Gets whether the operation ran out of time before it completed all + /// its intended actions. + /// + [JsonProperty(PropertyName = "maintenanceWindowExceeded")] + public bool? MaintenanceWindowExceeded { get; private set; } + + /// + /// Gets the number of patches that were not installed due to the user + /// blocking their installation. + /// + [JsonProperty(PropertyName = "excludedPatchCount")] + public int? ExcludedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were detected as available for + /// install, but did not meet the operation's criteria. + /// + [JsonProperty(PropertyName = "notSelectedPatchCount")] + public int? NotSelectedPatchCount { get; private set; } + + /// + /// Gets the number of patches that were identified as meeting the + /// installation criteria, but were not able to be installed. Typically + /// this happens when maintenanceWindowExceeded == true. + /// + [JsonProperty(PropertyName = "pendingPatchCount")] + public int? PendingPatchCount { get; private set; } + + /// + /// Gets the number of patches successfully installed. + /// + [JsonProperty(PropertyName = "installedPatchCount")] + public int? InstalledPatchCount { get; private set; } + + /// + /// Gets the number of patches that could not be installed due to some + /// issue. See errors for details. + /// + [JsonProperty(PropertyName = "failedPatchCount")] + public int? FailedPatchCount { get; private set; } + + /// + /// Gets the patches that were installed during the operation. + /// + [JsonProperty(PropertyName = "patches")] + public IList Patches { get; private set; } + + /// + /// Gets the UTC timestamp when the operation began. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; private set; } + + /// + /// Gets the errors that were encountered during execution of the + /// operation. The details array contains the list of them. + /// + [JsonProperty(PropertyName = "error")] + public ApiError Error { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstanceView.cs new file mode 100644 index 000000000000..0a9428321def --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineInstanceView.cs @@ -0,0 +1,202 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a virtual machine. + /// + public partial class VirtualMachineInstanceView + { + /// + /// Initializes a new instance of the VirtualMachineInstanceView class. + /// + public VirtualMachineInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineInstanceView class. + /// + /// Specifies the update domain of + /// the virtual machine. + /// Specifies the fault domain of the + /// virtual machine. + /// The computer name assigned to the + /// virtual machine. + /// The Operating System running on the virtual + /// machine. + /// The version of Operating System running on + /// the virtual machine. + /// Specifies the HyperVGeneration Type + /// associated with a resource. Possible values include: 'V1', + /// 'V2' + /// The Remote desktop certificate + /// thumbprint. + /// The VM Agent running on the virtual + /// machine. + /// The Maintenance Operation + /// status on the virtual machine. + /// The virtual machine disk information. + /// The extensions information. + /// The health status for the VM. + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. You can easily view the output of your console + /// log. Azure also enables you to see a screenshot of the VM from the + /// hypervisor. + /// Resource id of the dedicated host, on + /// which the virtual machine is allocated through automatic placement, + /// when the virtual machine is associated with a dedicated host group + /// that has automatic placement enabled. Minimum api-version: + /// 2020-06-01. + /// The resource status information. + /// [Preview Feature] The status of virtual + /// machine patch operations. + public VirtualMachineInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string computerName = default(string), string osName = default(string), string osVersion = default(string), string hyperVGeneration = default(string), string rdpThumbPrint = default(string), VirtualMachineAgentInstanceView vmAgent = default(VirtualMachineAgentInstanceView), MaintenanceRedeployStatus maintenanceRedeployStatus = default(MaintenanceRedeployStatus), IList disks = default(IList), IList extensions = default(IList), VirtualMachineHealthStatus vmHealth = default(VirtualMachineHealthStatus), BootDiagnosticsInstanceView bootDiagnostics = default(BootDiagnosticsInstanceView), string assignedHost = default(string), IList statuses = default(IList), VirtualMachinePatchStatus patchStatus = default(VirtualMachinePatchStatus)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + ComputerName = computerName; + OsName = osName; + OsVersion = osVersion; + HyperVGeneration = hyperVGeneration; + RdpThumbPrint = rdpThumbPrint; + VmAgent = vmAgent; + MaintenanceRedeployStatus = maintenanceRedeployStatus; + Disks = disks; + Extensions = extensions; + VmHealth = vmHealth; + BootDiagnostics = bootDiagnostics; + AssignedHost = assignedHost; + Statuses = statuses; + PatchStatus = patchStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the update domain of the virtual machine. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; set; } + + /// + /// Gets or sets specifies the fault domain of the virtual machine. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets the computer name assigned to the virtual machine. + /// + [JsonProperty(PropertyName = "computerName")] + public string ComputerName { get; set; } + + /// + /// Gets or sets the Operating System running on the virtual machine. + /// + [JsonProperty(PropertyName = "osName")] + public string OsName { get; set; } + + /// + /// Gets or sets the version of Operating System running on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "osVersion")] + public string OsVersion { get; set; } + + /// + /// Gets or sets specifies the HyperVGeneration Type associated with a + /// resource. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "hyperVGeneration")] + public string HyperVGeneration { get; set; } + + /// + /// Gets or sets the Remote desktop certificate thumbprint. + /// + [JsonProperty(PropertyName = "rdpThumbPrint")] + public string RdpThumbPrint { get; set; } + + /// + /// Gets or sets the VM Agent running on the virtual machine. + /// + [JsonProperty(PropertyName = "vmAgent")] + public VirtualMachineAgentInstanceView VmAgent { get; set; } + + /// + /// Gets or sets the Maintenance Operation status on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "maintenanceRedeployStatus")] + public MaintenanceRedeployStatus MaintenanceRedeployStatus { get; set; } + + /// + /// Gets or sets the virtual machine disk information. + /// + [JsonProperty(PropertyName = "disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets the health status for the VM. + /// + [JsonProperty(PropertyName = "vmHealth")] + public VirtualMachineHealthStatus VmHealth { get; private set; } + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// You can easily view the output of your console log. Azure also + /// enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnosticsInstanceView BootDiagnostics { get; set; } + + /// + /// Gets resource id of the dedicated host, on which the virtual + /// machine is allocated through automatic placement, when the virtual + /// machine is associated with a dedicated host group that has + /// automatic placement enabled. Minimum api-version: 2020-06-01. + /// + [JsonProperty(PropertyName = "assignedHost")] + public string AssignedHost { get; private set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets or sets [Preview Feature] The status of virtual machine patch + /// operations. + /// + [JsonProperty(PropertyName = "patchStatus")] + public VirtualMachinePatchStatus PatchStatus { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIpTag.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIpTag.cs new file mode 100644 index 000000000000..35ef67f4e918 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineIpTag.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the IP tag associated with the public IP address. + /// + public partial class VirtualMachineIpTag + { + /// + /// Initializes a new instance of the VirtualMachineIpTag class. + /// + public VirtualMachineIpTag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineIpTag class. + /// + /// IP tag type. Example: + /// FirstPartyUsage. + /// IP tag associated with the public IP. Example: + /// SQL, Storage etc. + public VirtualMachineIpTag(string ipTagType = default(string), string tag = default(string)) + { + IpTagType = ipTagType; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IP tag type. Example: FirstPartyUsage. + /// + [JsonProperty(PropertyName = "ipTagType")] + public string IpTagType { get; set; } + + /// + /// Gets or sets IP tag associated with the public IP. Example: SQL, + /// Storage etc. + /// + [JsonProperty(PropertyName = "tag")] + public string Tag { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs new file mode 100644 index 000000000000..7a6dcdd14c7e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs @@ -0,0 +1,205 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine network interface configurations. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineNetworkInterfaceConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceConfiguration class. + /// + public VirtualMachineNetworkInterfaceConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceConfiguration class. + /// + /// The network interface configuration + /// name. + /// Specifies the IP configurations of + /// the network interface. + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// Specify what happens to the network + /// interface when the VM is deleted. Possible values include: + /// 'Delete', 'Detach' + /// Specifies whether the + /// network interface is accelerated networking-enabled. + /// Specifies whether the network + /// interface is disabled for tcp state tracking. + /// Specifies whether the network interface is + /// FPGA networking-enabled. + /// Whether IP forwarding enabled on + /// this NIC. + /// The network security + /// group. + /// The dns settings to be applied on the + /// network interfaces. + /// Specifies whether the Auxiliary mode is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'AcceleratedConnections', 'Floating' + /// Specifies whether the Auxiliary sku is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'A1', 'A2', 'A4', 'A8' + public VirtualMachineNetworkInterfaceConfiguration(string name, IList ipConfigurations, bool? primary = default(bool?), string deleteOption = default(string), bool? enableAcceleratedNetworking = default(bool?), bool? disableTcpStateTracking = default(bool?), bool? enableFpga = default(bool?), bool? enableIPForwarding = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings = default(VirtualMachineNetworkInterfaceDnsSettingsConfiguration), SubResource dscpConfiguration = default(SubResource), string auxiliaryMode = default(string), string auxiliarySku = default(string)) + { + Name = name; + Primary = primary; + DeleteOption = deleteOption; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + DisableTcpStateTracking = disableTcpStateTracking; + EnableFpga = enableFpga; + EnableIPForwarding = enableIPForwarding; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + DscpConfiguration = dscpConfiguration; + AuxiliaryMode = auxiliaryMode; + AuxiliarySku = auxiliarySku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the network interface configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specify what happens to the network interface when the + /// VM is deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Gets or sets specifies whether the network interface is accelerated + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableAcceleratedNetworking")] + public bool? EnableAcceleratedNetworking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is disabled + /// for tcp state tracking. + /// + [JsonProperty(PropertyName = "properties.disableTcpStateTracking")] + public bool? DisableTcpStateTracking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is FPGA + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableFpga")] + public bool? EnableFpga { get; set; } + + /// + /// Gets or sets whether IP forwarding enabled on this NIC. + /// + [JsonProperty(PropertyName = "properties.enableIPForwarding")] + public bool? EnableIPForwarding { get; set; } + + /// + /// Gets or sets the network security group. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroup")] + public SubResource NetworkSecurityGroup { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the network + /// interfaces. + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration DnsSettings { get; set; } + + /// + /// Gets or sets specifies the IP configurations of the network + /// interface. + /// + [JsonProperty(PropertyName = "properties.ipConfigurations")] + public IList IpConfigurations { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.dscpConfiguration")] + public SubResource DscpConfiguration { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary mode is enabled for + /// the Network Interface resource. Possible values include: 'None', + /// 'AcceleratedConnections', 'Floating' + /// + [JsonProperty(PropertyName = "properties.auxiliaryMode")] + public string AuxiliaryMode { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary sku is enabled for the + /// Network Interface resource. Possible values include: 'None', 'A1', + /// 'A2', 'A4', 'A8' + /// + [JsonProperty(PropertyName = "properties.auxiliarySku")] + public string AuxiliarySku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (IpConfigurations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IpConfigurations"); + } + if (IpConfigurations != null) + { + foreach (var element in IpConfigurations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs new file mode 100644 index 000000000000..452f8771a091 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machines network configuration's DNS settings. + /// + public partial class VirtualMachineNetworkInterfaceDnsSettingsConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceDnsSettingsConfiguration class. + /// + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceDnsSettingsConfiguration class. + /// + /// List of DNS servers IP addresses + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration(IList dnsServers = default(IList)) + { + DnsServers = dnsServers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of DNS servers IP addresses + /// + [JsonProperty(PropertyName = "dnsServers")] + public IList DnsServers { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs new file mode 100644 index 000000000000..9ec3dac67959 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs @@ -0,0 +1,159 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine network profile's IP configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineNetworkInterfaceIPConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceIPConfiguration class. + /// + public VirtualMachineNetworkInterfaceIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineNetworkInterfaceIPConfiguration class. + /// + /// The IP configuration name. + /// Specifies the identifier of the + /// subnet. + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// The + /// publicIPAddressConfiguration. + /// Available from Api-Version + /// 2017-03-30 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + /// Possible values are: 'IPv4' and 'IPv6'. Possible values include: + /// 'IPv4', 'IPv6' + /// Specifies an array of + /// references to application security group. + /// Specifies an + /// array of references to backend address pools of application + /// gateways. A virtual machine can reference backend address pools of + /// multiple application gateways. Multiple virtual machines cannot use + /// the same application gateway. + /// Specifies an array of + /// references to backend address pools of load balancers. A virtual + /// machine can reference backend address pools of one public and one + /// internal load balancer. [Multiple virtual machines cannot use the + /// same basic sku load balancer]. + public VirtualMachineNetworkInterfaceIPConfiguration(string name, SubResource subnet = default(SubResource), bool? primary = default(bool?), VirtualMachinePublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachinePublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationSecurityGroups = default(IList), IList applicationGatewayBackendAddressPools = default(IList), IList loadBalancerBackendAddressPools = default(IList)) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationSecurityGroups = applicationSecurityGroups; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the identifier of the subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public SubResource Subnet { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets the publicIPAddressConfiguration. + /// + [JsonProperty(PropertyName = "properties.publicIPAddressConfiguration")] + public VirtualMachinePublicIPAddressConfiguration PublicIPAddressConfiguration { get; set; } + + /// + /// Gets or sets available from Api-Version 2017-03-30 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.privateIPAddressVersion")] + public string PrivateIPAddressVersion { get; set; } + + /// + /// Gets or sets specifies an array of references to application + /// security group. + /// + [JsonProperty(PropertyName = "properties.applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of application gateways. A virtual machine can reference + /// backend address pools of multiple application gateways. Multiple + /// virtual machines cannot use the same application gateway. + /// + [JsonProperty(PropertyName = "properties.applicationGatewayBackendAddressPools")] + public IList ApplicationGatewayBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of load balancers. A virtual machine can reference backend + /// address pools of one public and one internal load balancer. + /// [Multiple virtual machines cannot use the same basic sku load + /// balancer]. + /// + [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] + public IList LoadBalancerBackendAddressPools { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (PublicIPAddressConfiguration != null) + { + PublicIPAddressConfiguration.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePatchStatus.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePatchStatus.cs new file mode 100644 index 000000000000..bd1b95c7f635 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePatchStatus.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of virtual machine patch operations. + /// + public partial class VirtualMachinePatchStatus + { + /// + /// Initializes a new instance of the VirtualMachinePatchStatus class. + /// + public VirtualMachinePatchStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachinePatchStatus class. + /// + /// The available patch summary of + /// the latest assessment operation for the virtual machine. + /// The installation summary + /// of the latest installation operation for the virtual + /// machine. + /// The enablement status of the + /// specified patchMode + public VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary = default(AvailablePatchSummary), LastPatchInstallationSummary lastPatchInstallationSummary = default(LastPatchInstallationSummary), IList configurationStatuses = default(IList)) + { + AvailablePatchSummary = availablePatchSummary; + LastPatchInstallationSummary = lastPatchInstallationSummary; + ConfigurationStatuses = configurationStatuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the available patch summary of the latest assessment + /// operation for the virtual machine. + /// + [JsonProperty(PropertyName = "availablePatchSummary")] + public AvailablePatchSummary AvailablePatchSummary { get; set; } + + /// + /// Gets or sets the installation summary of the latest installation + /// operation for the virtual machine. + /// + [JsonProperty(PropertyName = "lastPatchInstallationSummary")] + public LastPatchInstallationSummary LastPatchInstallationSummary { get; set; } + + /// + /// Gets the enablement status of the specified patchMode + /// + [JsonProperty(PropertyName = "configurationStatuses")] + public IList ConfigurationStatuses { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePriorityTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePriorityTypes.cs new file mode 100644 index 000000000000..6a5d628ee3e3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePriorityTypes.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachinePriorityTypes. + /// + public static class VirtualMachinePriorityTypes + { + public const string Regular = "Regular"; + public const string Low = "Low"; + public const string Spot = "Spot"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs new file mode 100644 index 000000000000..573abfe35c08 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs @@ -0,0 +1,158 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machines IP Configuration's PublicIPAddress + /// configuration + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachinePublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachinePublicIPAddressConfiguration class. + /// + public VirtualMachinePublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachinePublicIPAddressConfiguration class. + /// + /// The publicIP address configuration name. + /// The idle timeout of the public + /// IP address. + /// Specify what happens to the public IP + /// address when the VM is deleted. Possible values include: 'Delete', + /// 'Detach' + /// The dns settings to be applied on the + /// publicIP addresses . + /// The list of IP tags associated with the public + /// IP address. + /// The PublicIPPrefix from which to + /// allocate publicIP addresses. + /// Available from Api-Version + /// 2019-07-01 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + /// values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + /// 'IPv6' + /// Specify the public IP + /// allocation type. Possible values include: 'Dynamic', + /// 'Static' + public VirtualMachinePublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes = default(int?), string deleteOption = default(string), VirtualMachinePublicIPAddressDnsSettingsConfiguration dnsSettings = default(VirtualMachinePublicIPAddressDnsSettingsConfiguration), IList ipTags = default(IList), SubResource publicIPPrefix = default(SubResource), string publicIPAddressVersion = default(string), string publicIPAllocationMethod = default(string), PublicIPAddressSku sku = default(PublicIPAddressSku)) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DeleteOption = deleteOption; + DnsSettings = dnsSettings; + IpTags = ipTags; + PublicIPPrefix = publicIPPrefix; + PublicIPAddressVersion = publicIPAddressVersion; + PublicIPAllocationMethod = publicIPAllocationMethod; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publicIP address configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the idle timeout of the public IP address. + /// + [JsonProperty(PropertyName = "properties.idleTimeoutInMinutes")] + public int? IdleTimeoutInMinutes { get; set; } + + /// + /// Gets or sets specify what happens to the public IP address when the + /// VM is deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the publicIP + /// addresses . + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachinePublicIPAddressDnsSettingsConfiguration DnsSettings { get; set; } + + /// + /// Gets or sets the list of IP tags associated with the public IP + /// address. + /// + [JsonProperty(PropertyName = "properties.ipTags")] + public IList IpTags { get; set; } + + /// + /// Gets or sets the PublicIPPrefix from which to allocate publicIP + /// addresses. + /// + [JsonProperty(PropertyName = "properties.publicIPPrefix")] + public SubResource PublicIPPrefix { get; set; } + + /// + /// Gets or sets available from Api-Version 2019-07-01 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.publicIPAddressVersion")] + public string PublicIPAddressVersion { get; set; } + + /// + /// Gets or sets specify the public IP allocation type. Possible values + /// include: 'Dynamic', 'Static' + /// + [JsonProperty(PropertyName = "properties.publicIPAllocationMethod")] + public string PublicIPAllocationMethod { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public PublicIPAddressSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (DnsSettings != null) + { + DnsSettings.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs new file mode 100644 index 000000000000..bb5e5d0f190f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machines network configuration's DNS settings. + /// + public partial class VirtualMachinePublicIPAddressDnsSettingsConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachinePublicIPAddressDnsSettingsConfiguration class. + /// + public VirtualMachinePublicIPAddressDnsSettingsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachinePublicIPAddressDnsSettingsConfiguration class. + /// + /// The Domain name label prefix of the + /// PublicIPAddress resources that will be created. The generated name + /// label is the concatenation of the domain name label and vm network + /// profile unique ID. + /// The Domain name label scope of + /// the PublicIPAddress resources that will be created. The generated + /// name label is the concatenation of the hashed domain name label + /// with policy according to the domain name label scope and vm network + /// profile unique ID. Possible values include: 'TenantReuse', + /// 'SubscriptionReuse', 'ResourceGroupReuse', 'NoReuse' + public VirtualMachinePublicIPAddressDnsSettingsConfiguration(string domainNameLabel, string domainNameLabelScope = default(string)) + { + DomainNameLabel = domainNameLabel; + DomainNameLabelScope = domainNameLabelScope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Domain name label prefix of the PublicIPAddress + /// resources that will be created. The generated name label is the + /// concatenation of the domain name label and vm network profile + /// unique ID. + /// + [JsonProperty(PropertyName = "domainNameLabel")] + public string DomainNameLabel { get; set; } + + /// + /// Gets or sets the Domain name label scope of the PublicIPAddress + /// resources that will be created. The generated name label is the + /// concatenation of the hashed domain name label with policy according + /// to the domain name label scope and vm network profile unique ID. + /// Possible values include: 'TenantReuse', 'SubscriptionReuse', + /// 'ResourceGroupReuse', 'NoReuse' + /// + [JsonProperty(PropertyName = "domainNameLabelScope")] + public string DomainNameLabelScope { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainNameLabel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainNameLabel"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineReimageParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineReimageParameters.cs new file mode 100644 index 000000000000..338862ff4467 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineReimageParameters.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk + /// will always be reimaged + /// + public partial class VirtualMachineReimageParameters + { + /// + /// Initializes a new instance of the VirtualMachineReimageParameters + /// class. + /// + public VirtualMachineReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineReimageParameters + /// class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version + /// the OS disk should be reimaged to. If exact version is not + /// provided, the OS disk is reimaged to the existing version of OS + /// Disk. + /// Specifies information required for + /// reimaging the non-ephemeral OS disk. + public VirtualMachineReimageParameters(bool? tempDisk = default(bool?), string exactVersion = default(string), OSProfileProvisioningData osProfile = default(OSProfileProvisioningData)) + { + TempDisk = tempDisk; + ExactVersion = exactVersion; + OsProfile = osProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether to reimage temp disk. Default value: + /// false. Note: This temp disk reimage parameter is only supported for + /// VM/VMSS with Ephemeral OS disk. + /// + [JsonProperty(PropertyName = "tempDisk")] + public bool? TempDisk { get; set; } + + /// + /// Gets or sets specifies in decimal number, the version the OS disk + /// should be reimaged to. If exact version is not provided, the OS + /// disk is reimaged to the existing version of OS Disk. + /// + [JsonProperty(PropertyName = "exactVersion")] + public string ExactVersion { get; set; } + + /// + /// Gets or sets specifies information required for reimaging the + /// non-ephemeral OS disk. + /// + [JsonProperty(PropertyName = "osProfile")] + public OSProfileProvisioningData OsProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommand.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommand.cs new file mode 100644 index 000000000000..a48ed0397d6a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommand.cs @@ -0,0 +1,286 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine run command. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineRunCommand : Resource + { + /// + /// Initializes a new instance of the VirtualMachineRunCommand class. + /// + public VirtualMachineRunCommand() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineRunCommand class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The source of the run command script. + /// The parameters used by the script. + /// The parameters used by the + /// script. + /// Optional. If set to true, provisioning + /// will complete as soon as the script starts and will not wait for + /// script to complete. + /// Specifies the user account on the VM when + /// executing the run command. + /// Specifies the user account password on + /// the VM when executing the run command. + /// The timeout in seconds to execute + /// the run command. + /// Specifies the Azure storage blob where + /// script output stream will be uploaded. Use a SAS URI with read, + /// append, create, write access OR use managed identity to provide the + /// VM access to the blob. Refer outputBlobManagedIdentity parameter. + /// + /// Specifies the Azure storage blob where + /// script error stream will be uploaded. Use a SAS URI with read, + /// append, create, write access OR use managed identity to provide the + /// VM access to the blob. Refer errorBlobManagedIdentity + /// parameter. + /// User-assigned managed + /// identity that has access to outputBlobUri storage blob. Use an + /// empty object in case of system-assigned identity. Make sure managed + /// identity has been given access to blob's container with 'Storage + /// Blob Data Contributor' role assignment. In case of user-assigned + /// identity, make sure you add it under VM's identity. For more info + /// on managed identity and Run Command, refer + /// https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + /// + /// User-assigned managed + /// identity that has access to errorBlobUri storage blob. Use an empty + /// object in case of system-assigned identity. Make sure managed + /// identity has been given access to blob's container with 'Storage + /// Blob Data Contributor' role assignment. In case of user-assigned + /// identity, make sure you add it under VM's identity. For more info + /// on managed identity and Run Command, refer + /// https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + /// + /// The provisioning state, which only + /// appears in the response. If treatFailureAsDeploymentFailure set to + /// true, any failure in the script will fail the deployment and + /// ProvisioningState will be marked as Failed. If + /// treatFailureAsDeploymentFailure set to false, ProvisioningState + /// would only reflect whether the run command was run or not by the + /// extensions platform, it would not indicate whether script failed in + /// case of script failures. See instance view of run command in case + /// of script failures to see executionMessage, output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + /// The virtual machine run command instance + /// view. + /// Optional. If set to + /// true, any failure in the script will fail the deployment and + /// ProvisioningState will be marked as Failed. If set to false, + /// ProvisioningState would only reflect whether the run command was + /// run or not by the extensions platform, it would not indicate + /// whether script failed in case of script failures. See instance view + /// of run command in case of script failures to see executionMessage, + /// output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + public VirtualMachineRunCommand(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), VirtualMachineRunCommandScriptSource source = default(VirtualMachineRunCommandScriptSource), IList parameters = default(IList), IList protectedParameters = default(IList), bool? asyncExecution = default(bool?), string runAsUser = default(string), string runAsPassword = default(string), int? timeoutInSeconds = default(int?), string outputBlobUri = default(string), string errorBlobUri = default(string), RunCommandManagedIdentity outputBlobManagedIdentity = default(RunCommandManagedIdentity), RunCommandManagedIdentity errorBlobManagedIdentity = default(RunCommandManagedIdentity), string provisioningState = default(string), VirtualMachineRunCommandInstanceView instanceView = default(VirtualMachineRunCommandInstanceView), bool? treatFailureAsDeploymentFailure = default(bool?)) + : base(location, id, name, type, tags) + { + Source = source; + Parameters = parameters; + ProtectedParameters = protectedParameters; + AsyncExecution = asyncExecution; + RunAsUser = runAsUser; + RunAsPassword = runAsPassword; + TimeoutInSeconds = timeoutInSeconds; + OutputBlobUri = outputBlobUri; + ErrorBlobUri = errorBlobUri; + OutputBlobManagedIdentity = outputBlobManagedIdentity; + ErrorBlobManagedIdentity = errorBlobManagedIdentity; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source of the run command script. + /// + [JsonProperty(PropertyName = "properties.source")] + public VirtualMachineRunCommandScriptSource Source { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public IList Parameters { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "properties.protectedParameters")] + public IList ProtectedParameters { get; set; } + + /// + /// Gets or sets optional. If set to true, provisioning will complete + /// as soon as the script starts and will not wait for script to + /// complete. + /// + [JsonProperty(PropertyName = "properties.asyncExecution")] + public bool? AsyncExecution { get; set; } + + /// + /// Gets or sets specifies the user account on the VM when executing + /// the run command. + /// + [JsonProperty(PropertyName = "properties.runAsUser")] + public string RunAsUser { get; set; } + + /// + /// Gets or sets specifies the user account password on the VM when + /// executing the run command. + /// + [JsonProperty(PropertyName = "properties.runAsPassword")] + public string RunAsPassword { get; set; } + + /// + /// Gets or sets the timeout in seconds to execute the run command. + /// + [JsonProperty(PropertyName = "properties.timeoutInSeconds")] + public int? TimeoutInSeconds { get; set; } + + /// + /// Gets or sets specifies the Azure storage blob where script output + /// stream will be uploaded. Use a SAS URI with read, append, create, + /// write access OR use managed identity to provide the VM access to + /// the blob. Refer outputBlobManagedIdentity parameter. + /// + [JsonProperty(PropertyName = "properties.outputBlobUri")] + public string OutputBlobUri { get; set; } + + /// + /// Gets or sets specifies the Azure storage blob where script error + /// stream will be uploaded. Use a SAS URI with read, append, create, + /// write access OR use managed identity to provide the VM access to + /// the blob. Refer errorBlobManagedIdentity parameter. + /// + [JsonProperty(PropertyName = "properties.errorBlobUri")] + public string ErrorBlobUri { get; set; } + + /// + /// Gets or sets user-assigned managed identity that has access to + /// outputBlobUri storage blob. Use an empty object in case of + /// system-assigned identity. Make sure managed identity has been given + /// access to blob's container with 'Storage Blob Data Contributor' + /// role assignment. In case of user-assigned identity, make sure you + /// add it under VM's identity. For more info on managed identity and + /// Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged + /// + [JsonProperty(PropertyName = "properties.outputBlobManagedIdentity")] + public RunCommandManagedIdentity OutputBlobManagedIdentity { get; set; } + + /// + /// Gets or sets user-assigned managed identity that has access to + /// errorBlobUri storage blob. Use an empty object in case of + /// system-assigned identity. Make sure managed identity has been given + /// access to blob's container with 'Storage Blob Data Contributor' + /// role assignment. In case of user-assigned identity, make sure you + /// add it under VM's identity. For more info on managed identity and + /// Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged + /// + [JsonProperty(PropertyName = "properties.errorBlobManagedIdentity")] + public RunCommandManagedIdentity ErrorBlobManagedIdentity { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. If + /// treatFailureAsDeploymentFailure set to true, any failure in the + /// script will fail the deployment and ProvisioningState will be + /// marked as Failed. If treatFailureAsDeploymentFailure set to false, + /// ProvisioningState would only reflect whether the run command was + /// run or not by the extensions platform, it would not indicate + /// whether script failed in case of script failures. See instance view + /// of run command in case of script failures to see executionMessage, + /// output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine run command instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineRunCommandInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets optional. If set to true, any failure in the script + /// will fail the deployment and ProvisioningState will be marked as + /// Failed. If set to false, ProvisioningState would only reflect + /// whether the run command was run or not by the extensions platform, + /// it would not indicate whether script failed in case of script + /// failures. See instance view of run command in case of script + /// failures to see executionMessage, output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + [JsonProperty(PropertyName = "properties.treatFailureAsDeploymentFailure")] + public bool? TreatFailureAsDeploymentFailure { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + if (ProtectedParameters != null) + { + foreach (var element1 in ProtectedParameters) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandInstanceView.cs new file mode 100644 index 000000000000..0c816fc3fa91 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandInstanceView.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a virtual machine run command. + /// + public partial class VirtualMachineRunCommandInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineRunCommandInstanceView class. + /// + public VirtualMachineRunCommandInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineRunCommandInstanceView class. + /// + /// Script execution status. Possible + /// values include: 'Unknown', 'Pending', 'Running', 'Failed', + /// 'Succeeded', 'TimedOut', 'Canceled' + /// Communicate script configuration + /// errors or execution messages. + /// Exit code returned from script + /// execution. + /// Script output stream. + /// Script error stream. + /// Script start time. + /// Script end time. + /// The resource status information. + public VirtualMachineRunCommandInstanceView(string executionState = default(string), string executionMessage = default(string), int? exitCode = default(int?), string output = default(string), string error = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), IList statuses = default(IList)) + { + ExecutionState = executionState; + ExecutionMessage = executionMessage; + ExitCode = exitCode; + Output = output; + Error = error; + StartTime = startTime; + EndTime = endTime; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets script execution status. Possible values include: + /// 'Unknown', 'Pending', 'Running', 'Failed', 'Succeeded', 'TimedOut', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "executionState")] + public string ExecutionState { get; set; } + + /// + /// Gets or sets communicate script configuration errors or execution + /// messages. + /// + [JsonProperty(PropertyName = "executionMessage")] + public string ExecutionMessage { get; set; } + + /// + /// Gets or sets exit code returned from script execution. + /// + [JsonProperty(PropertyName = "exitCode")] + public int? ExitCode { get; set; } + + /// + /// Gets or sets script output stream. + /// + [JsonProperty(PropertyName = "output")] + public string Output { get; set; } + + /// + /// Gets or sets script error stream. + /// + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } + + /// + /// Gets or sets script start time. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets script end time. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandScriptSource.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandScriptSource.cs new file mode 100644 index 000000000000..efaa45474c0d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandScriptSource.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the script sources for run command. Use only one of script, + /// scriptUri, commandId. + /// + public partial class VirtualMachineRunCommandScriptSource + { + /// + /// Initializes a new instance of the + /// VirtualMachineRunCommandScriptSource class. + /// + public VirtualMachineRunCommandScriptSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineRunCommandScriptSource class. + /// + /// Specifies the script content to be executed on + /// the VM. + /// Specifies the script download location. It + /// can be either SAS URI of an Azure storage blob with read access or + /// public URI. + /// Specifies a commandId of predefined + /// built-in script. + /// User-assigned managed + /// identity that has access to scriptUri in case of Azure storage + /// blob. Use an empty object in case of system-assigned identity. Make + /// sure the Azure storage blob exists, and managed identity has been + /// given access to blob's container with 'Storage Blob Data Reader' + /// role assignment. In case of user-assigned identity, make sure you + /// add it under VM's identity. For more info on managed identity and + /// Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged. + public VirtualMachineRunCommandScriptSource(string script = default(string), string scriptUri = default(string), string commandId = default(string), RunCommandManagedIdentity scriptUriManagedIdentity = default(RunCommandManagedIdentity)) + { + Script = script; + ScriptUri = scriptUri; + CommandId = commandId; + ScriptUriManagedIdentity = scriptUriManagedIdentity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the script content to be executed on the VM. + /// + [JsonProperty(PropertyName = "script")] + public string Script { get; set; } + + /// + /// Gets or sets specifies the script download location. It can be + /// either SAS URI of an Azure storage blob with read access or public + /// URI. + /// + [JsonProperty(PropertyName = "scriptUri")] + public string ScriptUri { get; set; } + + /// + /// Gets or sets specifies a commandId of predefined built-in script. + /// + [JsonProperty(PropertyName = "commandId")] + public string CommandId { get; set; } + + /// + /// Gets or sets user-assigned managed identity that has access to + /// scriptUri in case of Azure storage blob. Use an empty object in + /// case of system-assigned identity. Make sure the Azure storage blob + /// exists, and managed identity has been given access to blob's + /// container with 'Storage Blob Data Reader' role assignment. In case + /// of user-assigned identity, make sure you add it under VM's + /// identity. For more info on managed identity and Run Command, refer + /// https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged. + /// + [JsonProperty(PropertyName = "scriptUriManagedIdentity")] + public RunCommandManagedIdentity ScriptUriManagedIdentity { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandUpdate.cs new file mode 100644 index 000000000000..d495858d7f17 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineRunCommandUpdate.cs @@ -0,0 +1,254 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine run command. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineRunCommandUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineRunCommandUpdate + /// class. + /// + public VirtualMachineRunCommandUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineRunCommandUpdate + /// class. + /// + /// Resource tags + /// The source of the run command script. + /// The parameters used by the script. + /// The parameters used by the + /// script. + /// Optional. If set to true, provisioning + /// will complete as soon as the script starts and will not wait for + /// script to complete. + /// Specifies the user account on the VM when + /// executing the run command. + /// Specifies the user account password on + /// the VM when executing the run command. + /// The timeout in seconds to execute + /// the run command. + /// Specifies the Azure storage blob where + /// script output stream will be uploaded. Use a SAS URI with read, + /// append, create, write access OR use managed identity to provide the + /// VM access to the blob. Refer outputBlobManagedIdentity parameter. + /// + /// Specifies the Azure storage blob where + /// script error stream will be uploaded. Use a SAS URI with read, + /// append, create, write access OR use managed identity to provide the + /// VM access to the blob. Refer errorBlobManagedIdentity + /// parameter. + /// User-assigned managed + /// identity that has access to outputBlobUri storage blob. Use an + /// empty object in case of system-assigned identity. Make sure managed + /// identity has been given access to blob's container with 'Storage + /// Blob Data Contributor' role assignment. In case of user-assigned + /// identity, make sure you add it under VM's identity. For more info + /// on managed identity and Run Command, refer + /// https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + /// + /// User-assigned managed + /// identity that has access to errorBlobUri storage blob. Use an empty + /// object in case of system-assigned identity. Make sure managed + /// identity has been given access to blob's container with 'Storage + /// Blob Data Contributor' role assignment. In case of user-assigned + /// identity, make sure you add it under VM's identity. For more info + /// on managed identity and Run Command, refer + /// https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + /// + /// The provisioning state, which only + /// appears in the response. If treatFailureAsDeploymentFailure set to + /// true, any failure in the script will fail the deployment and + /// ProvisioningState will be marked as Failed. If + /// treatFailureAsDeploymentFailure set to false, ProvisioningState + /// would only reflect whether the run command was run or not by the + /// extensions platform, it would not indicate whether script failed in + /// case of script failures. See instance view of run command in case + /// of script failures to see executionMessage, output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + /// The virtual machine run command instance + /// view. + /// Optional. If set to + /// true, any failure in the script will fail the deployment and + /// ProvisioningState will be marked as Failed. If set to false, + /// ProvisioningState would only reflect whether the run command was + /// run or not by the extensions platform, it would not indicate + /// whether script failed in case of script failures. See instance view + /// of run command in case of script failures to see executionMessage, + /// output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + public VirtualMachineRunCommandUpdate(IDictionary tags = default(IDictionary), VirtualMachineRunCommandScriptSource source = default(VirtualMachineRunCommandScriptSource), IList parameters = default(IList), IList protectedParameters = default(IList), bool? asyncExecution = default(bool?), string runAsUser = default(string), string runAsPassword = default(string), int? timeoutInSeconds = default(int?), string outputBlobUri = default(string), string errorBlobUri = default(string), RunCommandManagedIdentity outputBlobManagedIdentity = default(RunCommandManagedIdentity), RunCommandManagedIdentity errorBlobManagedIdentity = default(RunCommandManagedIdentity), string provisioningState = default(string), VirtualMachineRunCommandInstanceView instanceView = default(VirtualMachineRunCommandInstanceView), bool? treatFailureAsDeploymentFailure = default(bool?)) + : base(tags) + { + Source = source; + Parameters = parameters; + ProtectedParameters = protectedParameters; + AsyncExecution = asyncExecution; + RunAsUser = runAsUser; + RunAsPassword = runAsPassword; + TimeoutInSeconds = timeoutInSeconds; + OutputBlobUri = outputBlobUri; + ErrorBlobUri = errorBlobUri; + OutputBlobManagedIdentity = outputBlobManagedIdentity; + ErrorBlobManagedIdentity = errorBlobManagedIdentity; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source of the run command script. + /// + [JsonProperty(PropertyName = "properties.source")] + public VirtualMachineRunCommandScriptSource Source { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public IList Parameters { get; set; } + + /// + /// Gets or sets the parameters used by the script. + /// + [JsonProperty(PropertyName = "properties.protectedParameters")] + public IList ProtectedParameters { get; set; } + + /// + /// Gets or sets optional. If set to true, provisioning will complete + /// as soon as the script starts and will not wait for script to + /// complete. + /// + [JsonProperty(PropertyName = "properties.asyncExecution")] + public bool? AsyncExecution { get; set; } + + /// + /// Gets or sets specifies the user account on the VM when executing + /// the run command. + /// + [JsonProperty(PropertyName = "properties.runAsUser")] + public string RunAsUser { get; set; } + + /// + /// Gets or sets specifies the user account password on the VM when + /// executing the run command. + /// + [JsonProperty(PropertyName = "properties.runAsPassword")] + public string RunAsPassword { get; set; } + + /// + /// Gets or sets the timeout in seconds to execute the run command. + /// + [JsonProperty(PropertyName = "properties.timeoutInSeconds")] + public int? TimeoutInSeconds { get; set; } + + /// + /// Gets or sets specifies the Azure storage blob where script output + /// stream will be uploaded. Use a SAS URI with read, append, create, + /// write access OR use managed identity to provide the VM access to + /// the blob. Refer outputBlobManagedIdentity parameter. + /// + [JsonProperty(PropertyName = "properties.outputBlobUri")] + public string OutputBlobUri { get; set; } + + /// + /// Gets or sets specifies the Azure storage blob where script error + /// stream will be uploaded. Use a SAS URI with read, append, create, + /// write access OR use managed identity to provide the VM access to + /// the blob. Refer errorBlobManagedIdentity parameter. + /// + [JsonProperty(PropertyName = "properties.errorBlobUri")] + public string ErrorBlobUri { get; set; } + + /// + /// Gets or sets user-assigned managed identity that has access to + /// outputBlobUri storage blob. Use an empty object in case of + /// system-assigned identity. Make sure managed identity has been given + /// access to blob's container with 'Storage Blob Data Contributor' + /// role assignment. In case of user-assigned identity, make sure you + /// add it under VM's identity. For more info on managed identity and + /// Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged + /// + [JsonProperty(PropertyName = "properties.outputBlobManagedIdentity")] + public RunCommandManagedIdentity OutputBlobManagedIdentity { get; set; } + + /// + /// Gets or sets user-assigned managed identity that has access to + /// errorBlobUri storage blob. Use an empty object in case of + /// system-assigned identity. Make sure managed identity has been given + /// access to blob's container with 'Storage Blob Data Contributor' + /// role assignment. In case of user-assigned identity, make sure you + /// add it under VM's identity. For more info on managed identity and + /// Run Command, refer https://aka.ms/ManagedIdentity and + /// https://aka.ms/RunCommandManaged + /// + [JsonProperty(PropertyName = "properties.errorBlobManagedIdentity")] + public RunCommandManagedIdentity ErrorBlobManagedIdentity { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. If + /// treatFailureAsDeploymentFailure set to true, any failure in the + /// script will fail the deployment and ProvisioningState will be + /// marked as Failed. If treatFailureAsDeploymentFailure set to false, + /// ProvisioningState would only reflect whether the run command was + /// run or not by the extensions platform, it would not indicate + /// whether script failed in case of script failures. See instance view + /// of run command in case of script failures to see executionMessage, + /// output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine run command instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineRunCommandInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets optional. If set to true, any failure in the script + /// will fail the deployment and ProvisioningState will be marked as + /// Failed. If set to false, ProvisioningState would only reflect + /// whether the run command was run or not by the extensions platform, + /// it would not indicate whether script failed in case of script + /// failures. See instance view of run command in case of script + /// failures to see executionMessage, output, error: + /// https://aka.ms/runcommandmanaged#get-execution-status-and-results + /// + [JsonProperty(PropertyName = "properties.treatFailureAsDeploymentFailure")] + public bool? TreatFailureAsDeploymentFailure { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSet.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSet.cs new file mode 100644 index 000000000000..eff56b667038 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSet.cs @@ -0,0 +1,351 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSet : Resource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + public VirtualMachineScaleSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine scale set 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**. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// The provisioning state, which only + /// appears in the response. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// Specifies the ID which uniquely identifies a + /// Virtual Machine Scale Set. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Whether to force strictly even Virtual + /// Machine distribution cross x-zones in case there is zone outage. + /// zoneBalance property can only be set if the zones property of the + /// scale set contains more than one zone. If there are no zones or + /// only one zone specified, then zoneBalance property should not be + /// set. + /// Fault Domain count for each + /// placement group. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. Minimum api-version: 2018-04-01. + /// Specifies information about the dedicated + /// host group that the virtual machine scale set resides in. Minimum + /// api-version: 2020-06-01. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the policies applied when + /// scaling in Virtual Machines in the Virtual Machine Scale + /// Set. + /// Specifies the orchestration mode + /// for the virtual machine scale set. Possible values include: + /// 'Uniform', 'Flexible' + /// Specifies the Spot Restore + /// properties for the virtual machine scale set. + /// Specifies the desired targets for + /// mixing Spot and Regular priority VMs within the same VMSS Flex + /// instance. + /// Specifies the time at which the Virtual + /// Machine Scale Set resource was created. Minimum api-version: + /// 2021-11-01. + /// Optional property which + /// must either be set to True or omitted. + /// The identity of the virtual machine scale + /// set, if configured. + /// The virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale + /// set + /// The extended location of the Virtual + /// Machine Scale Set. + public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), SubResource hostGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), string orchestrationMode = default(string), SpotRestorePolicy spotRestorePolicy = default(SpotRestorePolicy), PriorityMixPolicy priorityMixPolicy = default(PriorityMixPolicy), System.DateTime? timeCreated = default(System.DateTime?), bool? constrainedMaximumCapacity = default(bool?), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + ProvisioningState = provisioningState; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + UniqueId = uniqueId; + SinglePlacementGroup = singlePlacementGroup; + ZoneBalance = zoneBalance; + PlatformFaultDomainCount = platformFaultDomainCount; + ProximityPlacementGroup = proximityPlacementGroup; + HostGroup = hostGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + OrchestrationMode = orchestrationMode; + SpotRestorePolicy = spotRestorePolicy; + PriorityMixPolicy = priorityMixPolicy; + TimeCreated = timeCreated; + ConstrainedMaximumCapacity = constrainedMaximumCapacity; + Identity = identity; + Zones = zones; + ExtendedLocation = extendedLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets 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 -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets the upgrade policy. + /// + [JsonProperty(PropertyName = "properties.upgradePolicy")] + public UpgradePolicy UpgradePolicy { get; set; } + + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + + /// + /// Gets or sets the virtual machine profile. + /// + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineScaleSetVMProfile VirtualMachineProfile { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets specifies whether the Virtual Machine Scale Set should + /// be overprovisioned. + /// + [JsonProperty(PropertyName = "properties.overprovision")] + public bool? Overprovision { get; set; } + + /// + /// Gets or sets when Overprovision is enabled, extensions are launched + /// only on the requested number of VMs which are finally kept. This + /// property will hence ensure that the extensions do not run on the + /// extra overprovisioned VMs. + /// + [JsonProperty(PropertyName = "properties.doNotRunExtensionsOnOverprovisionedVMs")] + public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } + + /// + /// Gets specifies the ID which uniquely identifies a Virtual Machine + /// Scale Set. + /// + [JsonProperty(PropertyName = "properties.uniqueId")] + public string UniqueId { get; private set; } + + /// + /// Gets or sets when true this limits the scale set to a single + /// placement group, of max size 100 virtual machines. NOTE: If + /// singlePlacementGroup is true, it may be modified to false. However, + /// if singlePlacementGroup is false, it may not be modified to true. + /// + [JsonProperty(PropertyName = "properties.singlePlacementGroup")] + public bool? SinglePlacementGroup { get; set; } + + /// + /// Gets or sets whether to force strictly even Virtual Machine + /// distribution cross x-zones in case there is zone outage. + /// zoneBalance property can only be set if the zones property of the + /// scale set contains more than one zone. If there are no zones or + /// only one zone specified, then zoneBalance property should not be + /// set. + /// + [JsonProperty(PropertyName = "properties.zoneBalance")] + public bool? ZoneBalance { get; set; } + + /// + /// Gets or sets fault Domain count for each placement group. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomainCount")] + public int? PlatformFaultDomainCount { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine scale set should be assigned to. + /// Minimum api-version: 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine scale set resides in. Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the Virtual Machines in the Virtual Machine Scale Set. For + /// instance: whether the Virtual Machines have the capability to + /// support attaching managed data disks with UltraSSD_LRS storage + /// account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the policies applied when scaling in Virtual + /// Machines in the Virtual Machine Scale Set. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + + /// + /// Gets or sets specifies the orchestration mode for the virtual + /// machine scale set. Possible values include: 'Uniform', 'Flexible' + /// + [JsonProperty(PropertyName = "properties.orchestrationMode")] + public string OrchestrationMode { get; set; } + + /// + /// Gets or sets specifies the Spot Restore properties for the virtual + /// machine scale set. + /// + [JsonProperty(PropertyName = "properties.spotRestorePolicy")] + public SpotRestorePolicy SpotRestorePolicy { get; set; } + + /// + /// Gets or sets specifies the desired targets for mixing Spot and + /// Regular priority VMs within the same VMSS Flex instance. + /// + [JsonProperty(PropertyName = "properties.priorityMixPolicy")] + public PriorityMixPolicy PriorityMixPolicy { get; set; } + + /// + /// Gets specifies the time at which the Virtual Machine Scale Set + /// resource was created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets optional property which must either be set to True or + /// omitted. + /// + [JsonProperty(PropertyName = "properties.constrainedMaximumCapacity")] + public bool? ConstrainedMaximumCapacity { get; set; } + + /// + /// Gets or sets the identity of the virtual machine scale set, if + /// configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineScaleSetIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine scale set zones. NOTE: + /// Availability zones can only be set when you create the scale set + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the extended location of the Virtual Machine Scale + /// Set. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (UpgradePolicy != null) + { + UpgradePolicy.Validate(); + } + if (VirtualMachineProfile != null) + { + VirtualMachineProfile.Validate(); + } + if (PriorityMixPolicy != null) + { + PriorityMixPolicy.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetDataDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetDataDisk.cs new file mode 100644 index 000000000000..7ad35b9d758d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetDataDisk.cs @@ -0,0 +1,191 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machine scale set data disk. + /// + public partial class VirtualMachineScaleSetDataDisk + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetDataDisk + /// class. + /// + public VirtualMachineScaleSetDataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetDataDisk + /// class. + /// + /// 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. + /// The create option. Possible values + /// include: 'FromImage', 'Empty', 'Attach' + /// The disk name. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The default + /// values are: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. The property diskSizeGB is the + /// number of bytes x 1024^3 for the disk and the value cannot be + /// larger than 1023. + /// The managed disk parameters. + /// Specifies the Read-Write IOPS for + /// the managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// Specifies the bandwidth in MB per + /// second for the managed disk. Should be used only when + /// StorageAccountType is UltraSSD_LRS. If not specified, a default + /// value would be assigned based on diskSizeGB. + /// Specifies whether data disk should be + /// deleted or detached upon VMSS Flex deletion (This feature is + /// available for VMSS with Flexible OrchestrationMode + /// only).<br><br> Possible values: <br><br> + /// **Delete** If this value is used, the data disk is deleted when the + /// VMSS Flex VM is deleted.<br><br> **Detach** If this + /// value is used, the data disk is retained after VMSS Flex VM is + /// deleted.<br><br> The default value is set to + /// **Delete**. Possible values include: 'Delete', 'Detach' + public VirtualMachineScaleSetDataDisk(int lun, string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), string deleteOption = default(string)) + { + Name = name; + Lun = lun; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiskSizeGB = diskSizeGB; + ManagedDisk = managedDisk; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "lun")] + public int Lun { get; set; } + + /// + /// Gets or sets specifies the caching requirements. Possible values + /// are: **None,** **ReadOnly,** **ReadWrite.** The default values are: + /// **None for Standard storage. ReadOnly for Premium storage.**. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets the create option. Possible values include: + /// 'FromImage', 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. The property diskSizeGB is the number of + /// bytes x 1024^3 for the disk and the value cannot be larger than + /// 1023. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies the Read-Write IOPS for the managed disk. + /// Should be used only when StorageAccountType is UltraSSD_LRS. If not + /// specified, a default value would be assigned based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets specifies the bandwidth in MB per second for the + /// managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets specifies whether data disk should be deleted or + /// detached upon VMSS Flex deletion (This feature is available for + /// VMSS with Flexible OrchestrationMode + /// only).&lt;br&gt;&lt;br&gt; Possible values: + /// &lt;br&gt;&lt;br&gt; **Delete** If this value is + /// used, the data disk is deleted when the VMSS Flex VM is + /// deleted.&lt;br&gt;&lt;br&gt; **Detach** If this + /// value is used, the data disk is retained after VMSS Flex VM is + /// deleted.&lt;br&gt;&lt;br&gt; The default value is + /// set to **Delete**. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtension.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtension.cs new file mode 100644 index 000000000000..e73c85a639e0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtension.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetExtension : SubResourceReadOnly + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtension + /// class. + /// + public VirtualMachineScaleSetExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtension + /// class. + /// + /// Resource Id + /// The name of the extension. + /// Resource type + /// If a value is provided and is + /// different from the previous value, the extension handler will be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The provisioning state, which only + /// appears in the response. + /// Collection of extension + /// names after which this extension needs to be provisioned. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + public VirtualMachineScaleSetExtension(string id = default(string), string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), IList provisionAfterExtensions = default(IList), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + : base(id) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + ProvisionAfterExtensions = provisionAfterExtensions; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets if a value is provided and is different from the + /// previous value, the extension handler will be forced to update even + /// if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs new file mode 100644 index 000000000000..d042d05dd967 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set extension profile. + /// + public partial class VirtualMachineScaleSetExtensionProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionProfile class. + /// + public VirtualMachineScaleSetExtensionProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionProfile class. + /// + /// The virtual machine scale set child + /// extension resources. + /// 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. + public VirtualMachineScaleSetExtensionProfile(IList extensions = default(IList), string extensionsTimeBudget = default(string)) + { + Extensions = extensions; + ExtensionsTimeBudget = extensionsTimeBudget; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set child extension + /// resources. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs new file mode 100644 index 000000000000..11e1ba59579c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs @@ -0,0 +1,212 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetExtensionUpdate : IResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionUpdate class. + /// + public VirtualMachineScaleSetExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetExtensionUpdate class. + /// + /// The name of the extension. + /// Resource type + /// If a value is provided and is + /// different from the previous value, the extension handler will be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The provisioning state, which only + /// appears in the response. + /// Collection of extension + /// names after which this extension needs to be provisioned. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + public VirtualMachineScaleSetExtensionUpdate(string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), IList provisionAfterExtensions = default(IList), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + ProvisionAfterExtensions = provisionAfterExtensions; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets if a value is provided and is different from the + /// previous value, the extension handler will be forced to update even + /// if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs new file mode 100644 index 000000000000..f7f3aec32bef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the hardware settings for the virtual machine scale set. + /// + public partial class VirtualMachineScaleSetHardwareProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetHardwareProfile class. + /// + public VirtualMachineScaleSetHardwareProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetHardwareProfile class. + /// + /// Specifies the properties for + /// customizing the size of the virtual machine. Minimum api-version: + /// 2021-11-01. Please follow the instructions in [VM + /// Customization](https://aka.ms/vmcustomization) for more + /// details. + public VirtualMachineScaleSetHardwareProfile(VMSizeProperties vmSizeProperties = default(VMSizeProperties)) + { + VmSizeProperties = vmSizeProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the properties for customizing the size of + /// the virtual machine. Minimum api-version: 2021-11-01. Please follow + /// the instructions in [VM + /// Customization](https://aka.ms/vmcustomization) for more details. + /// + [JsonProperty(PropertyName = "vmSizeProperties")] + public VMSizeProperties VmSizeProperties { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs new file mode 100644 index 000000000000..9a89b2a68020 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile's IP + /// configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetIPConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIPConfiguration class. + /// + public VirtualMachineScaleSetIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetIPConfiguration class. + /// + /// The IP configuration name. + /// Specifies the identifier of the + /// subnet. + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// The + /// publicIPAddressConfiguration. + /// Available from Api-Version + /// 2017-03-30 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + /// Possible values are: 'IPv4' and 'IPv6'. Possible values include: + /// 'IPv4', 'IPv6' + /// Specifies an + /// array of references to backend address pools of application + /// gateways. A scale set can reference backend address pools of + /// multiple application gateways. Multiple scale sets cannot use the + /// same application gateway. + /// Specifies an array of + /// references to application security group. + /// Specifies an array of + /// references to backend address pools of load balancers. A scale set + /// can reference backend address pools of one public and one internal + /// load balancer. Multiple scale sets cannot use the same basic sku + /// load balancer. + /// 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. + public VirtualMachineScaleSetIPConfiguration(string name, ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetPublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the identifier of the subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public ApiEntityReference Subnet { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets the publicIPAddressConfiguration. + /// + [JsonProperty(PropertyName = "properties.publicIPAddressConfiguration")] + public VirtualMachineScaleSetPublicIPAddressConfiguration PublicIPAddressConfiguration { get; set; } + + /// + /// Gets or sets available from Api-Version 2017-03-30 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.privateIPAddressVersion")] + public string PrivateIPAddressVersion { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of application gateways. A scale set can reference backend + /// address pools of multiple application gateways. Multiple scale sets + /// cannot use the same application gateway. + /// + [JsonProperty(PropertyName = "properties.applicationGatewayBackendAddressPools")] + public IList ApplicationGatewayBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to application + /// security group. + /// + [JsonProperty(PropertyName = "properties.applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + /// + /// Gets or sets specifies an array of references to backend address + /// pools of load balancers. A scale set can reference backend address + /// pools of one public and one internal load balancer. Multiple scale + /// sets cannot use the same basic sku load balancer. + /// + [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] + public IList LoadBalancerBackendAddressPools { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.loadBalancerInboundNatPools")] + public IList LoadBalancerInboundNatPools { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (PublicIPAddressConfiguration != null) + { + PublicIPAddressConfiguration.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIdentity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIdentity.cs new file mode 100644 index 000000000000..d4c98ce3b702 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIdentity.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Identity for the virtual machine scale set. + /// + public partial class VirtualMachineScaleSetIdentity + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetIdentity + /// class. + /// + public VirtualMachineScaleSetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetIdentity + /// class. + /// + /// The principal id of virtual machine scale + /// set identity. This property will only be provided for a system + /// assigned identity. + /// The tenant id associated with the virtual + /// machine scale set. This property will only be provided for a system + /// assigned identity. + /// The type of identity used for the virtual + /// machine scale set. The type 'SystemAssigned, UserAssigned' includes + /// both an implicitly created identity and a set of user assigned + /// identities. The type 'None' will remove any identities from the + /// virtual machine scale set. Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' + /// The list of user identities + /// associated with the virtual machine scale set. The user identity + /// dictionary key references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public VirtualMachineScaleSetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of virtual machine scale set identity. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id associated with the virtual machine scale set. + /// This property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the type of identity used for the virtual machine + /// scale set. The type 'SystemAssigned, UserAssigned' includes both an + /// implicitly created identity and a set of user assigned identities. + /// The type 'None' will remove any identities from the virtual machine + /// scale set. Possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the list of user identities associated with the + /// virtual machine scale set. The user identity dictionary key + /// references will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceView.cs new file mode 100644 index 000000000000..0b6757db7d77 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceView.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a virtual machine scale set. + /// + public partial class VirtualMachineScaleSetInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceView class. + /// + public VirtualMachineScaleSetInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceView class. + /// + /// The instance view status summary for + /// the virtual machine scale set. + /// The extensions information. + /// The resource status information. + /// The orchestration services + /// information. + public VirtualMachineScaleSetInstanceView(VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine = default(VirtualMachineScaleSetInstanceViewStatusesSummary), IList extensions = default(IList), IList statuses = default(IList), IList orchestrationServices = default(IList)) + { + VirtualMachine = virtualMachine; + Extensions = extensions; + Statuses = statuses; + OrchestrationServices = orchestrationServices; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the instance view status summary for the virtual machine scale + /// set. + /// + [JsonProperty(PropertyName = "virtualMachine")] + public VirtualMachineScaleSetInstanceViewStatusesSummary VirtualMachine { get; private set; } + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; private set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets the orchestration services information. + /// + [JsonProperty(PropertyName = "orchestrationServices")] + public IList OrchestrationServices { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs new file mode 100644 index 000000000000..2d55aefcac5e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Instance view statuses summary for virtual machines of a virtual + /// machine scale set. + /// + public partial class VirtualMachineScaleSetInstanceViewStatusesSummary + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceViewStatusesSummary class. + /// + public VirtualMachineScaleSetInstanceViewStatusesSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetInstanceViewStatusesSummary class. + /// + /// The extensions information. + public VirtualMachineScaleSetInstanceViewStatusesSummary(IList statusesSummary = default(IList)) + { + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIpTag.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIpTag.cs new file mode 100644 index 000000000000..2fb2b4a7d812 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetIpTag.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the IP tag associated with the public IP address. + /// + public partial class VirtualMachineScaleSetIpTag + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetIpTag + /// class. + /// + public VirtualMachineScaleSetIpTag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetIpTag + /// class. + /// + /// IP tag type. Example: + /// FirstPartyUsage. + /// IP tag associated with the public IP. Example: + /// SQL, Storage etc. + public VirtualMachineScaleSetIpTag(string ipTagType = default(string), string tag = default(string)) + { + IpTagType = ipTagType; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IP tag type. Example: FirstPartyUsage. + /// + [JsonProperty(PropertyName = "ipTagType")] + public string IpTagType { get; set; } + + /// + /// Gets or sets IP tag associated with the public IP. Example: SQL, + /// Storage etc. + /// + [JsonProperty(PropertyName = "tag")] + public string Tag { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs new file mode 100644 index 000000000000..db483a29a1ae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the parameters of a ScaleSet managed disk. + /// + public partial class VirtualMachineScaleSetManagedDiskParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetManagedDiskParameters class. + /// + public VirtualMachineScaleSetManagedDiskParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetManagedDiskParameters class. + /// + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + /// Specifies the security profile for + /// the managed disk. + public VirtualMachineScaleSetManagedDiskParameters(string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters), VMDiskSecurityProfile securityProfile = default(VMDiskSecurityProfile)) + { + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + SecurityProfile = securityProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', + /// 'Premium_ZRS', 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + /// + /// Gets or sets specifies the security profile for the managed disk. + /// + [JsonProperty(PropertyName = "securityProfile")] + public VMDiskSecurityProfile SecurityProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs new file mode 100644 index 000000000000..0a2de6134e2f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs @@ -0,0 +1,199 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile's network + /// configurations. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetNetworkConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfiguration class. + /// + public VirtualMachineScaleSetNetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfiguration class. + /// + /// The network configuration name. + /// Specifies the IP configurations of + /// the network interface. + /// Specifies the primary network interface in + /// case the virtual machine has more than 1 network interface. + /// Specifies whether the + /// network interface is accelerated networking-enabled. + /// Specifies whether the network + /// interface is disabled for tcp state tracking. + /// Specifies whether the network interface is + /// FPGA networking-enabled. + /// The network security + /// group. + /// The dns settings to be applied on the + /// network interfaces. + /// Whether IP forwarding enabled on + /// this NIC. + /// Specify what happens to the network + /// interface when the VM is deleted. Possible values include: + /// 'Delete', 'Detach' + /// Specifies whether the Auxiliary mode is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'AcceleratedConnections', 'Floating' + /// Specifies whether the Auxiliary sku is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'A1', 'A2', 'A4', 'A8' + public VirtualMachineScaleSetNetworkConfiguration(string name, IList ipConfigurations, bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? disableTcpStateTracking = default(bool?), bool? enableFpga = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), bool? enableIPForwarding = default(bool?), string deleteOption = default(string), string auxiliaryMode = default(string), string auxiliarySku = default(string)) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + DisableTcpStateTracking = disableTcpStateTracking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + AuxiliaryMode = auxiliaryMode; + AuxiliarySku = auxiliarySku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the network configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the primary network interface in case the + /// virtual machine has more than 1 network interface. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specifies whether the network interface is accelerated + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableAcceleratedNetworking")] + public bool? EnableAcceleratedNetworking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is disabled + /// for tcp state tracking. + /// + [JsonProperty(PropertyName = "properties.disableTcpStateTracking")] + public bool? DisableTcpStateTracking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is FPGA + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableFpga")] + public bool? EnableFpga { get; set; } + + /// + /// Gets or sets the network security group. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroup")] + public SubResource NetworkSecurityGroup { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the network + /// interfaces. + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets specifies the IP configurations of the network + /// interface. + /// + [JsonProperty(PropertyName = "properties.ipConfigurations")] + public IList IpConfigurations { get; set; } + + /// + /// Gets or sets whether IP forwarding enabled on this NIC. + /// + [JsonProperty(PropertyName = "properties.enableIPForwarding")] + public bool? EnableIPForwarding { get; set; } + + /// + /// Gets or sets specify what happens to the network interface when the + /// VM is deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary mode is enabled for + /// the Network Interface resource. Possible values include: 'None', + /// 'AcceleratedConnections', 'Floating' + /// + [JsonProperty(PropertyName = "properties.auxiliaryMode")] + public string AuxiliaryMode { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary sku is enabled for the + /// Network Interface resource. Possible values include: 'None', 'A1', + /// 'A2', 'A4', 'A8' + /// + [JsonProperty(PropertyName = "properties.auxiliarySku")] + public string AuxiliarySku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (IpConfigurations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IpConfigurations"); + } + if (IpConfigurations != null) + { + foreach (var element in IpConfigurations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs new file mode 100644 index 000000000000..4509c496042d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machines scale sets network configuration's DNS + /// settings. + /// + public partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfigurationDnsSettings class. + /// + public VirtualMachineScaleSetNetworkConfigurationDnsSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkConfigurationDnsSettings class. + /// + /// List of DNS servers IP addresses + public VirtualMachineScaleSetNetworkConfigurationDnsSettings(IList dnsServers = default(IList)) + { + DnsServers = dnsServers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of DNS servers IP addresses + /// + [JsonProperty(PropertyName = "dnsServers")] + public IList DnsServers { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs new file mode 100644 index 000000000000..ac86f1d80802 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile. + /// + public partial class VirtualMachineScaleSetNetworkProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkProfile class. + /// + public VirtualMachineScaleSetNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetNetworkProfile class. + /// + /// A reference to a load balancer probe used + /// to determine the health of an instance in the virtual machine scale + /// set. The reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// The list of network + /// configurations. + /// specifies the Microsoft.Network API + /// version used when creating networking resources in the Network + /// Interface Configurations for Virtual Machine Scale Set with + /// orchestration mode 'Flexible'. Possible values include: + /// '2020-11-01' + public VirtualMachineScaleSetNetworkProfile(ApiEntityReference healthProbe = default(ApiEntityReference), IList networkInterfaceConfigurations = default(IList), string networkApiVersion = default(string)) + { + HealthProbe = healthProbe; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + NetworkApiVersion = networkApiVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a reference to a load balancer probe used to determine + /// the health of an instance in the virtual machine scale set. The + /// reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// + [JsonProperty(PropertyName = "healthProbe")] + public ApiEntityReference HealthProbe { get; set; } + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + /// + /// Gets or sets specifies the Microsoft.Network API version used when + /// creating networking resources in the Network Interface + /// Configurations for Virtual Machine Scale Set with orchestration + /// mode 'Flexible'. Possible values include: '2020-11-01' + /// + [JsonProperty(PropertyName = "networkApiVersion")] + public string NetworkApiVersion { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSDisk.cs new file mode 100644 index 000000000000..94ff840f523d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSDisk.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set operating system disk. + /// + public partial class VirtualMachineScaleSetOSDisk + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSDisk + /// class. + /// + public VirtualMachineScaleSetOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSDisk + /// class. + /// + /// Specifies how the virtual machines in + /// the scale set should be created. The only allowed value is: + /// **FromImage.** This value is used when you are using an image to + /// create the virtual machine. If you are using a platform image, you + /// also use the imageReference element described above. If you are + /// using a marketplace image, you also use the plan element + /// previously described. Possible values include: 'FromImage', + /// 'Empty', 'Attach' + /// The disk name. + /// Specifies the caching requirements. Possible + /// values are: **None,** **ReadOnly,** **ReadWrite.** The default + /// values are: **None for Standard storage. ReadOnly for Premium + /// storage.**. Possible values include: 'None', 'ReadOnly', + /// 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the ephemeral disk + /// Settings for the operating system disk used by the virtual machine + /// scale set. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. The property 'diskSizeGB' is the + /// number of bytes x 1024^3 for the disk and the value cannot be + /// larger than 1023. + /// This property allows you to specify the type + /// of the OS that is included in the disk if creating a VM from + /// user-image or a specialized VHD. Possible values are: **Windows,** + /// **Linux.**. Possible values include: 'Windows', 'Linux' + /// Specifies information about the unmanaged user + /// image to base the scale set on. + /// Specifies the container urls that are + /// used to store operating system disks for the scale set. + /// The managed disk parameters. + /// Specifies whether OS Disk should be + /// deleted or detached upon VMSS Flex deletion (This feature is + /// available for VMSS with Flexible OrchestrationMode only). + /// <br><br> Possible values: <br><br> + /// **Delete** If this value is used, the OS disk is deleted when VMSS + /// Flex VM is deleted.<br><br> **Detach** If this value is + /// used, the OS disk is retained after VMSS Flex VM is deleted. + /// <br><br> The default value is set to **Delete**. For an + /// Ephemeral OS Disk, the default value is set to **Delete**. User + /// cannot change the delete option for Ephemeral OS Disk. Possible + /// values include: 'Delete', 'Detach' + public VirtualMachineScaleSetOSDisk(string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), DiffDiskSettings diffDiskSettings = default(DiffDiskSettings), int? diskSizeGB = default(int?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), VirtualHardDisk image = default(VirtualHardDisk), IList vhdContainers = default(IList), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters), string deleteOption = default(string)) + { + Name = name; + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + CreateOption = createOption; + DiffDiskSettings = diffDiskSettings; + DiskSizeGB = diskSizeGB; + OsType = osType; + Image = image; + VhdContainers = vhdContainers; + ManagedDisk = managedDisk; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the caching requirements. Possible values + /// are: **None,** **ReadOnly,** **ReadWrite.** The default values are: + /// **None for Standard storage. ReadOnly for Premium storage.**. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies how the virtual machines in the scale set + /// should be created. The only allowed value is: **FromImage.** This + /// value is used when you are using an image to create the virtual + /// machine. If you are using a platform image, you also use the + /// imageReference element described above. If you are using a + /// marketplace image, you also use the plan element previously + /// described. Possible values include: 'FromImage', 'Empty', 'Attach' + /// + [JsonProperty(PropertyName = "createOption")] + public string CreateOption { get; set; } + + /// + /// Gets or sets specifies the ephemeral disk Settings for the + /// operating system disk used by the virtual machine scale set. + /// + [JsonProperty(PropertyName = "diffDiskSettings")] + public DiffDiskSettings DiffDiskSettings { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. The property 'diskSizeGB' is the number of + /// bytes x 1024^3 for the disk and the value cannot be larger than + /// 1023. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets this property allows you to specify the type of the OS + /// that is included in the disk if creating a VM from user-image or a + /// specialized VHD. Possible values are: **Windows,** **Linux.**. + /// Possible values include: 'Windows', 'Linux' + /// + [JsonProperty(PropertyName = "osType")] + public OperatingSystemTypes? OsType { get; set; } + + /// + /// Gets or sets specifies information about the unmanaged user image + /// to base the scale set on. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets specifies the container urls that are used to store + /// operating system disks for the scale set. + /// + [JsonProperty(PropertyName = "vhdContainers")] + public IList VhdContainers { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies whether OS Disk should be deleted or + /// detached upon VMSS Flex deletion (This feature is available for + /// VMSS with Flexible OrchestrationMode only). + /// &lt;br&gt;&lt;br&gt; Possible values: + /// &lt;br&gt;&lt;br&gt; **Delete** If this value is + /// used, the OS disk is deleted when VMSS Flex VM is + /// deleted.&lt;br&gt;&lt;br&gt; **Detach** If this + /// value is used, the OS disk is retained after VMSS Flex VM is + /// deleted. &lt;br&gt;&lt;br&gt; The default value is + /// set to **Delete**. For an Ephemeral OS Disk, the default value is + /// set to **Delete**. User cannot change the delete option for + /// Ephemeral OS Disk. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CreateOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreateOption"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSProfile.cs new file mode 100644 index 000000000000..a89473267f38 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetOSProfile.cs @@ -0,0 +1,221 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set OS profile. + /// + public partial class VirtualMachineScaleSetOSProfile + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSProfile + /// class. + /// + public VirtualMachineScaleSetOSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetOSProfile + /// class. + /// + /// Specifies the computer name prefix + /// for all of the virtual machines in the scale set. Computer name + /// prefixes must be 1 to 15 characters long. + /// Specifies the name of the administrator + /// account. <br><br> **Windows-only restriction:** Cannot + /// end in "." <br><br> **Disallowed values:** + /// "administrator", "admin", "user", "user1", "test", "user2", + /// "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", + /// "admin2", "aspnet", "backup", "console", "david", "guest", "john", + /// "owner", "root", "server", "sql", "support", "support_388945a0", + /// "sys", "test2", "test3", "user4", "user5". <br><br> + /// **Minimum-length (Linux):** 1 character <br><br> + /// **Max-length (Linux):** 64 characters <br><br> + /// **Max-length (Windows):** 20 characters + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// Specifies a base-64 encoded string of + /// custom data. The base-64 encoded string is decoded to a binary + /// array that is saved as a file on the Virtual Machine. The maximum + /// length of the binary array is 65535 bytes. For using cloud-init for + /// your VM, see [Using cloud-init to customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + /// Specifies Windows operating + /// system settings on the virtual machine. + /// Specifies the Linux operating + /// system settings on the virtual machine. For a list of supported + /// Linux distributions, see [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// Specifies set of certificates that should be + /// installed onto the virtual machines in the scale set. To install + /// certificates on a virtual machine it is recommended to use the + /// [Azure Key Vault virtual machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// Specifies whether extension + /// operations should be allowed on the virtual machine scale set. This + /// may only be set to False when no extensions are present on the + /// virtual machine scale set. + /// Optional property which + /// must either be set to True or omitted. + public VirtualMachineScaleSetOSProfile(string computerNamePrefix = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList), bool? allowExtensionOperations = default(bool?), bool? requireGuestProvisionSignal = default(bool?)) + { + ComputerNamePrefix = computerNamePrefix; + AdminUsername = adminUsername; + AdminPassword = adminPassword; + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + AllowExtensionOperations = allowExtensionOperations; + RequireGuestProvisionSignal = requireGuestProvisionSignal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the computer name prefix for all of the + /// virtual machines in the scale set. Computer name prefixes must be 1 + /// to 15 characters long. + /// + [JsonProperty(PropertyName = "computerNamePrefix")] + public string ComputerNamePrefix { get; set; } + + /// + /// Gets or sets specifies the name of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Windows-only restriction:** + /// Cannot end in "." &lt;br&gt;&lt;br&gt; **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Linux):** 1 + /// character &lt;br&gt;&lt;br&gt; **Max-length + /// (Linux):** 64 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 20 characters + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies a base-64 encoded string of custom data. The + /// base-64 encoded string is decoded to a binary array that is saved + /// as a file on the Virtual Machine. The maximum length of the binary + /// array is 65535 bytes. For using cloud-init for your VM, see [Using + /// cloud-init to customize a Linux VM during + /// creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets specifies Windows operating system settings on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets specifies the Linux operating system settings on the + /// virtual machine. For a list of supported Linux distributions, see + /// [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets specifies set of certificates that should be installed + /// onto the virtual machines in the scale set. To install certificates + /// on a virtual machine it is recommended to use the [Azure Key Vault + /// virtual machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + /// + /// Gets or sets specifies whether extension operations should be + /// allowed on the virtual machine scale set. This may only be set to + /// False when no extensions are present on the virtual machine scale + /// set. + /// + [JsonProperty(PropertyName = "allowExtensionOperations")] + public bool? AllowExtensionOperations { get; set; } + + /// + /// Gets or sets optional property which must either be set to True or + /// omitted. + /// + [JsonProperty(PropertyName = "requireGuestProvisionSignal")] + public bool? RequireGuestProvisionSignal { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs new file mode 100644 index 000000000000..7be218d6cda9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machines scale set IP Configuration's + /// PublicIPAddress configuration + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetPublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfiguration class. + /// + public VirtualMachineScaleSetPublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfiguration class. + /// + /// The publicIP address configuration name. + /// The idle timeout of the public + /// IP address. + /// The dns settings to be applied on the + /// publicIP addresses . + /// The list of IP tags associated with the public + /// IP address. + /// The PublicIPPrefix from which to + /// allocate publicIP addresses. + /// Available from Api-Version + /// 2019-07-01 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + /// values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + /// 'IPv6' + /// Specify what happens to the public IP + /// when the VM is deleted. Possible values include: 'Delete', + /// 'Detach' + public VirtualMachineScaleSetPublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings), IList ipTags = default(IList), SubResource publicIPPrefix = default(SubResource), string publicIPAddressVersion = default(string), string deleteOption = default(string), PublicIPAddressSku sku = default(PublicIPAddressSku)) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + IpTags = ipTags; + PublicIPPrefix = publicIPPrefix; + PublicIPAddressVersion = publicIPAddressVersion; + DeleteOption = deleteOption; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publicIP address configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the idle timeout of the public IP address. + /// + [JsonProperty(PropertyName = "properties.idleTimeoutInMinutes")] + public int? IdleTimeoutInMinutes { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the publicIP + /// addresses . + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets the list of IP tags associated with the public IP + /// address. + /// + [JsonProperty(PropertyName = "properties.ipTags")] + public IList IpTags { get; set; } + + /// + /// Gets or sets the PublicIPPrefix from which to allocate publicIP + /// addresses. + /// + [JsonProperty(PropertyName = "properties.publicIPPrefix")] + public SubResource PublicIPPrefix { get; set; } + + /// + /// Gets or sets available from Api-Version 2019-07-01 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.publicIPAddressVersion")] + public string PublicIPAddressVersion { get; set; } + + /// + /// Gets or sets specify what happens to the public IP when the VM is + /// deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public PublicIPAddressSku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (DnsSettings != null) + { + DnsSettings.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs new file mode 100644 index 000000000000..b62d2eacd133 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machines scale sets network configuration's DNS + /// settings. + /// + public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + /// class. + /// + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + /// class. + /// + /// The Domain name label.The + /// concatenation of the domain name label and vm index will be the + /// domain name labels of the PublicIPAddress resources that will be + /// created + /// The Domain name label scope.The + /// concatenation of the hashed domain name label that generated + /// according to the policy from domain name label scope and vm index + /// will be the domain name labels of the PublicIPAddress resources + /// that will be created. Possible values include: 'TenantReuse', + /// 'SubscriptionReuse', 'ResourceGroupReuse', 'NoReuse' + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string domainNameLabel, string domainNameLabelScope = default(string)) + { + DomainNameLabel = domainNameLabel; + DomainNameLabelScope = domainNameLabelScope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Domain name label.The concatenation of the domain + /// name label and vm index will be the domain name labels of the + /// PublicIPAddress resources that will be created + /// + [JsonProperty(PropertyName = "domainNameLabel")] + public string DomainNameLabel { get; set; } + + /// + /// Gets or sets the Domain name label scope.The concatenation of the + /// hashed domain name label that generated according to the policy + /// from domain name label scope and vm index will be the domain name + /// labels of the PublicIPAddress resources that will be created. + /// Possible values include: 'TenantReuse', 'SubscriptionReuse', + /// 'ResourceGroupReuse', 'NoReuse' + /// + [JsonProperty(PropertyName = "domainNameLabelScope")] + public string DomainNameLabelScope { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainNameLabel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainNameLabel"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetReimageParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetReimageParameters.cs new file mode 100644 index 000000000000..50dedaa12305 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetReimageParameters.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set VM Reimage Parameters. + /// + public partial class VirtualMachineScaleSetReimageParameters : VirtualMachineScaleSetVMReimageParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetReimageParameters class. + /// + public VirtualMachineScaleSetReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetReimageParameters class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version + /// the OS disk should be reimaged to. If exact version is not + /// provided, the OS disk is reimaged to the existing version of OS + /// Disk. + /// Specifies information required for + /// reimaging the non-ephemeral OS disk. + /// 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. + public VirtualMachineScaleSetReimageParameters(bool? tempDisk = default(bool?), string exactVersion = default(string), OSProfileProvisioningData osProfile = default(OSProfileProvisioningData), IList instanceIds = default(IList)) + : base(tempDisk, exactVersion, osProfile) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetScaleInRules.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetScaleInRules.cs new file mode 100644 index 000000000000..bbe4bf22bc33 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetScaleInRules.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachineScaleSetScaleInRules. + /// + public static class VirtualMachineScaleSetScaleInRules + { + public const string Default = "Default"; + public const string OldestVM = "OldestVM"; + public const string NewestVM = "NewestVM"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSku.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSku.cs new file mode 100644 index 000000000000..8aa58b7d8474 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSku.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an available virtual machine scale set sku. + /// + public partial class VirtualMachineScaleSetSku + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetSku class. + /// + public VirtualMachineScaleSetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetSku class. + /// + /// The type of resource the sku applies + /// to. + /// The Sku. + /// Specifies the number of virtual machines in + /// the scale set. + public VirtualMachineScaleSetSku(string resourceType = default(string), Sku sku = default(Sku), VirtualMachineScaleSetSkuCapacity capacity = default(VirtualMachineScaleSetSkuCapacity)) + { + ResourceType = resourceType; + Sku = sku; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the sku applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the Sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; private set; } + + /// + /// Gets specifies the number of virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "capacity")] + public VirtualMachineScaleSetSkuCapacity Capacity { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs new file mode 100644 index 000000000000..769672d81222 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes scaling information of a sku. + /// + public partial class VirtualMachineScaleSetSkuCapacity + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetSkuCapacity + /// class. + /// + public VirtualMachineScaleSetSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetSkuCapacity + /// class. + /// + /// The minimum capacity. + /// The maximum capacity that can be set. + /// The default capacity. + /// The scale type applicable to the sku. + /// Possible values include: 'Automatic', 'None' + public VirtualMachineScaleSetSkuCapacity(long? minimum = default(long?), long? maximum = default(long?), long? defaultCapacity = default(long?), VirtualMachineScaleSetSkuScaleType? scaleType = default(VirtualMachineScaleSetSkuScaleType?)) + { + Minimum = minimum; + Maximum = maximum; + DefaultCapacity = defaultCapacity; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the minimum capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public long? Minimum { get; private set; } + + /// + /// Gets the maximum capacity that can be set. + /// + [JsonProperty(PropertyName = "maximum")] + public long? Maximum { get; private set; } + + /// + /// Gets the default capacity. + /// + [JsonProperty(PropertyName = "defaultCapacity")] + public long? DefaultCapacity { get; private set; } + + /// + /// Gets the scale type applicable to the sku. Possible values include: + /// 'Automatic', 'None' + /// + [JsonProperty(PropertyName = "scaleType")] + public VirtualMachineScaleSetSkuScaleType? ScaleType { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs new file mode 100644 index 000000000000..37eb1dcb7da7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetSkuScaleType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for VirtualMachineScaleSetSkuScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum VirtualMachineScaleSetSkuScaleType + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "None")] + None + } + internal static class VirtualMachineScaleSetSkuScaleTypeEnumExtension + { + internal static string ToSerializedValue(this VirtualMachineScaleSetSkuScaleType? value) + { + return value == null ? null : ((VirtualMachineScaleSetSkuScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this VirtualMachineScaleSetSkuScaleType value) + { + switch( value ) + { + case VirtualMachineScaleSetSkuScaleType.Automatic: + return "Automatic"; + case VirtualMachineScaleSetSkuScaleType.None: + return "None"; + } + return null; + } + + internal static VirtualMachineScaleSetSkuScaleType? ParseVirtualMachineScaleSetSkuScaleType(this string value) + { + switch( value ) + { + case "Automatic": + return VirtualMachineScaleSetSkuScaleType.Automatic; + case "None": + return VirtualMachineScaleSetSkuScaleType.None; + } + return null; + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetStorageProfile.cs new file mode 100644 index 000000000000..098d3755ef83 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetStorageProfile.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set storage profile. + /// + public partial class VirtualMachineScaleSetStorageProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetStorageProfile class. + /// + public VirtualMachineScaleSetStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetStorageProfile class. + /// + /// 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. + /// Specifies information about the operating + /// system disk used by the virtual machines in the scale set. For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// Specifies the parameters that are used to + /// add data disks to the virtual machines in the scale set. For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + public VirtualMachineScaleSetStorageProfile(ImageReference imageReference = default(ImageReference), VirtualMachineScaleSetOSDisk osDisk = default(VirtualMachineScaleSetOSDisk), IList dataDisks = default(IList), string diskControllerType = default(string)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + DiskControllerType = diskControllerType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets specifies information about the operating system disk + /// used by the virtual machines in the scale set. For more information + /// about disks, see [About disks and VHDs for Azure virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "osDisk")] + public VirtualMachineScaleSetOSDisk OsDisk { get; set; } + + /// + /// Gets or sets specifies the parameters that are used to add data + /// disks to the virtual machines in the scale set. For more + /// information about disks, see [About disks and VHDs for Azure + /// virtual + /// machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// + [JsonProperty(PropertyName = "diskControllerType")] + public string DiskControllerType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdate.cs new file mode 100644 index 000000000000..d46cb62a9b4d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdate.cs @@ -0,0 +1,225 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetUpdate + /// class. + /// + public VirtualMachineScaleSetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetUpdate + /// class. + /// + /// Resource tags + /// The virtual machine scale set sku. + /// The purchase plan when deploying a virtual + /// machine scale set from VM Marketplace images. + /// The upgrade policy. + /// Policy for automatic + /// repairs. + /// The virtual machine + /// profile. + /// Specifies whether the Virtual Machine + /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. + /// When true this limits the scale + /// set to a single placement group, of max size 100 virtual machines. + /// NOTE: If singlePlacementGroup is true, it may be modified to false. + /// However, if singlePlacementGroup is false, it may not be modified + /// to true. + /// Specifies additional + /// capabilities enabled or disabled on the Virtual Machines in the + /// Virtual Machine Scale Set. For instance: whether the Virtual + /// Machines have the capability to support attaching managed data + /// disks with UltraSSD_LRS storage account type. + /// Specifies the policies applied when + /// scaling in Virtual Machines in the Virtual Machine Scale + /// Set. + /// Specifies information about + /// the proximity placement group that the virtual machine scale set + /// should be assigned to. <br><br>Minimum api-version: + /// 2018-04-01. + /// Specifies the desired targets for + /// mixing Spot and Regular priority VMs within the same VMSS Flex + /// instance. + /// Specifies the Spot Restore + /// properties for the virtual machine scale set. + /// The identity of the virtual machine scale + /// set, if configured. + public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), SubResource proximityPlacementGroup = default(SubResource), PriorityMixPolicy priorityMixPolicy = default(PriorityMixPolicy), SpotRestorePolicy spotRestorePolicy = default(SpotRestorePolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) + : base(tags) + { + Sku = sku; + Plan = plan; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + SinglePlacementGroup = singlePlacementGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + ProximityPlacementGroup = proximityPlacementGroup; + PriorityMixPolicy = priorityMixPolicy; + SpotRestorePolicy = spotRestorePolicy; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set sku. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets the purchase plan when deploying a virtual machine + /// scale set from VM Marketplace images. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets the upgrade policy. + /// + [JsonProperty(PropertyName = "properties.upgradePolicy")] + public UpgradePolicy UpgradePolicy { get; set; } + + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + + /// + /// Gets or sets the virtual machine profile. + /// + [JsonProperty(PropertyName = "properties.virtualMachineProfile")] + public VirtualMachineScaleSetUpdateVMProfile VirtualMachineProfile { get; set; } + + /// + /// Gets or sets specifies whether the Virtual Machine Scale Set should + /// be overprovisioned. + /// + [JsonProperty(PropertyName = "properties.overprovision")] + public bool? Overprovision { get; set; } + + /// + /// Gets or sets when Overprovision is enabled, extensions are launched + /// only on the requested number of VMs which are finally kept. This + /// property will hence ensure that the extensions do not run on the + /// extra overprovisioned VMs. + /// + [JsonProperty(PropertyName = "properties.doNotRunExtensionsOnOverprovisionedVMs")] + public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } + + /// + /// Gets or sets when true this limits the scale set to a single + /// placement group, of max size 100 virtual machines. NOTE: If + /// singlePlacementGroup is true, it may be modified to false. However, + /// if singlePlacementGroup is false, it may not be modified to true. + /// + [JsonProperty(PropertyName = "properties.singlePlacementGroup")] + public bool? SinglePlacementGroup { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the Virtual Machines in the Virtual Machine Scale Set. For + /// instance: whether the Virtual Machines have the capability to + /// support attaching managed data disks with UltraSSD_LRS storage + /// account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the policies applied when scaling in Virtual + /// Machines in the Virtual Machine Scale Set. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine scale set should be assigned to. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies the desired targets for mixing Spot and + /// Regular priority VMs within the same VMSS Flex instance. + /// + [JsonProperty(PropertyName = "properties.priorityMixPolicy")] + public PriorityMixPolicy PriorityMixPolicy { get; set; } + + /// + /// Gets or sets specifies the Spot Restore properties for the virtual + /// machine scale set. + /// + [JsonProperty(PropertyName = "properties.spotRestorePolicy")] + public SpotRestorePolicy SpotRestorePolicy { get; set; } + + /// + /// Gets or sets the identity of the virtual machine scale set, if + /// configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineScaleSetIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UpgradePolicy != null) + { + UpgradePolicy.Validate(); + } + if (PriorityMixPolicy != null) + { + PriorityMixPolicy.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs new file mode 100644 index 000000000000..b70b05f5047f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs @@ -0,0 +1,155 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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 + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdateIPConfiguration : IResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateIPConfiguration class. + /// + public VirtualMachineScaleSetUpdateIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateIPConfiguration class. + /// + /// The IP configuration name. + /// The subnet. + /// Specifies the primary IP Configuration in + /// case the network interface has more than one IP + /// Configuration. + /// The + /// publicIPAddressConfiguration. + /// Available from Api-Version + /// 2017-03-30 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + /// Possible values are: 'IPv4' and 'IPv6'. Possible values include: + /// 'IPv4', 'IPv6' + /// The application + /// gateway backend address pools. + /// Specifies an array of + /// references to application security group. + /// The load balancer + /// backend address pools. + /// The load balancer inbound + /// nat pools. + public VirtualMachineScaleSetUpdateIPConfiguration(string name = default(string), ApiEntityReference subnet = default(ApiEntityReference), bool? primary = default(bool?), VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration = default(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration), string privateIPAddressVersion = default(string), IList applicationGatewayBackendAddressPools = default(IList), IList applicationSecurityGroups = default(IList), IList loadBalancerBackendAddressPools = default(IList), IList loadBalancerInboundNatPools = default(IList)) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public ApiEntityReference Subnet { get; set; } + + /// + /// Gets or sets specifies the primary IP Configuration in case the + /// network interface has more than one IP Configuration. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets the publicIPAddressConfiguration. + /// + [JsonProperty(PropertyName = "properties.publicIPAddressConfiguration")] + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration PublicIPAddressConfiguration { get; set; } + + /// + /// Gets or sets available from Api-Version 2017-03-30 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.privateIPAddressVersion")] + public string PrivateIPAddressVersion { get; set; } + + /// + /// Gets or sets the application gateway backend address pools. + /// + [JsonProperty(PropertyName = "properties.applicationGatewayBackendAddressPools")] + public IList ApplicationGatewayBackendAddressPools { get; set; } + + /// + /// Gets or sets specifies an array of references to application + /// security group. + /// + [JsonProperty(PropertyName = "properties.applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + /// + /// Gets or sets the load balancer backend address pools. + /// + [JsonProperty(PropertyName = "properties.loadBalancerBackendAddressPools")] + public IList LoadBalancerBackendAddressPools { get; set; } + + /// + /// Gets or sets the load balancer inbound nat pools. + /// + [JsonProperty(PropertyName = "properties.loadBalancerInboundNatPools")] + public IList LoadBalancerInboundNatPools { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PublicIPAddressConfiguration != null) + { + PublicIPAddressConfiguration.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs new file mode 100644 index 000000000000..5f16ae3d9c65 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs @@ -0,0 +1,171 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile's network + /// configurations. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : IResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkConfiguration class. + /// + public VirtualMachineScaleSetUpdateNetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkConfiguration class. + /// + /// The network configuration name. + /// Whether this is a primary NIC on a virtual + /// machine. + /// Specifies whether the + /// network interface is accelerated networking-enabled. + /// Specifies whether the network + /// interface is disabled for tcp state tracking. + /// Specifies whether the network interface is + /// FPGA networking-enabled. + /// The network security + /// group. + /// The dns settings to be applied on the + /// network interfaces. + /// The virtual machine scale set IP + /// Configuration. + /// Whether IP forwarding enabled on + /// this NIC. + /// Specify what happens to the network + /// interface when the VM is deleted. Possible values include: + /// 'Delete', 'Detach' + /// Specifies whether the Auxiliary mode is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'AcceleratedConnections', 'Floating' + /// Specifies whether the Auxiliary sku is + /// enabled for the Network Interface resource. Possible values + /// include: 'None', 'A1', 'A2', 'A4', 'A8' + public VirtualMachineScaleSetUpdateNetworkConfiguration(string name = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? disableTcpStateTracking = default(bool?), bool? enableFpga = default(bool?), SubResource networkSecurityGroup = default(SubResource), VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetNetworkConfigurationDnsSettings), IList ipConfigurations = default(IList), bool? enableIPForwarding = default(bool?), string deleteOption = default(string), string auxiliaryMode = default(string), string auxiliarySku = default(string)) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + DisableTcpStateTracking = disableTcpStateTracking; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IpConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + AuxiliaryMode = auxiliaryMode; + AuxiliarySku = auxiliarySku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the network configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets whether this is a primary NIC on a virtual machine. + /// + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } + + /// + /// Gets or sets specifies whether the network interface is accelerated + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableAcceleratedNetworking")] + public bool? EnableAcceleratedNetworking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is disabled + /// for tcp state tracking. + /// + [JsonProperty(PropertyName = "properties.disableTcpStateTracking")] + public bool? DisableTcpStateTracking { get; set; } + + /// + /// Gets or sets specifies whether the network interface is FPGA + /// networking-enabled. + /// + [JsonProperty(PropertyName = "properties.enableFpga")] + public bool? EnableFpga { get; set; } + + /// + /// Gets or sets the network security group. + /// + [JsonProperty(PropertyName = "properties.networkSecurityGroup")] + public SubResource NetworkSecurityGroup { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the network + /// interfaces. + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets the virtual machine scale set IP Configuration. + /// + [JsonProperty(PropertyName = "properties.ipConfigurations")] + public IList IpConfigurations { get; set; } + + /// + /// Gets or sets whether IP forwarding enabled on this NIC. + /// + [JsonProperty(PropertyName = "properties.enableIPForwarding")] + public bool? EnableIPForwarding { get; set; } + + /// + /// Gets or sets specify what happens to the network interface when the + /// VM is deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary mode is enabled for + /// the Network Interface resource. Possible values include: 'None', + /// 'AcceleratedConnections', 'Floating' + /// + [JsonProperty(PropertyName = "properties.auxiliaryMode")] + public string AuxiliaryMode { get; set; } + + /// + /// Gets or sets specifies whether the Auxiliary sku is enabled for the + /// Network Interface resource. Possible values include: 'None', 'A1', + /// 'A2', 'A4', 'A8' + /// + [JsonProperty(PropertyName = "properties.auxiliarySku")] + public string AuxiliarySku { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs new file mode 100644 index 000000000000..2e451d422faa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set network profile. + /// + public partial class VirtualMachineScaleSetUpdateNetworkProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkProfile class. + /// + public VirtualMachineScaleSetUpdateNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateNetworkProfile class. + /// + /// A reference to a load balancer probe used + /// to determine the health of an instance in the virtual machine scale + /// set. The reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// The list of network + /// configurations. + /// specifies the Microsoft.Network API + /// version used when creating networking resources in the Network + /// Interface Configurations for Virtual Machine Scale Set with + /// orchestration mode 'Flexible'. Possible values include: + /// '2020-11-01' + public VirtualMachineScaleSetUpdateNetworkProfile(ApiEntityReference healthProbe = default(ApiEntityReference), IList networkInterfaceConfigurations = default(IList), string networkApiVersion = default(string)) + { + HealthProbe = healthProbe; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + NetworkApiVersion = networkApiVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a reference to a load balancer probe used to determine + /// the health of an instance in the virtual machine scale set. The + /// reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// + [JsonProperty(PropertyName = "healthProbe")] + public ApiEntityReference HealthProbe { get; set; } + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + /// + /// Gets or sets specifies the Microsoft.Network API version used when + /// creating networking resources in the Network Interface + /// Configurations for Virtual Machine Scale Set with orchestration + /// mode 'Flexible'. Possible values include: '2020-11-01' + /// + [JsonProperty(PropertyName = "networkApiVersion")] + public string NetworkApiVersion { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs new file mode 100644 index 000000000000..f66566e74977 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes virtual machine scale set operating system disk Update + /// Object. This should be used for Updating VMSS OS Disk. + /// + public partial class VirtualMachineScaleSetUpdateOSDisk + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSDisk class. + /// + public VirtualMachineScaleSetUpdateOSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSDisk class. + /// + /// The caching type. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies whether + /// writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk + /// in gigabytes. This element can be used to overwrite the size of the + /// disk in a virtual machine image. <br><br> diskSizeGB is + /// the number of bytes x 1024^3 for the disk and the value cannot be + /// larger than 1023 + /// The Source User Image VirtualHardDisk. This + /// VirtualHardDisk will be copied before using it to attach to the + /// Virtual Machine. If SourceImage is provided, the destination + /// VirtualHardDisk should not exist. + /// The list of virtual hard disk container + /// uris. + /// The managed disk parameters. + /// Specifies whether OS Disk should be + /// deleted or detached upon VMSS Flex deletion (This feature is + /// available for VMSS with Flexible OrchestrationMode only). + /// <br><br> Possible values: <br><br> + /// **Delete** If this value is used, the OS disk is deleted when VMSS + /// Flex VM is deleted.<br><br> **Detach** If this value is + /// used, the OS disk is retained after VMSS Flex VM is deleted. + /// <br><br> The default value is set to **Delete**. For an + /// Ephemeral OS Disk, the default value is set to **Delete**. User + /// cannot change the delete option for Ephemeral OS Disk. Possible + /// values include: 'Delete', 'Detach' + public VirtualMachineScaleSetUpdateOSDisk(CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualHardDisk image = default(VirtualHardDisk), IList vhdContainers = default(IList), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters), string deleteOption = default(string)) + { + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + DiskSizeGB = diskSizeGB; + Image = image; + VhdContainers = vhdContainers; + ManagedDisk = managedDisk; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the caching type. Possible values include: 'None', + /// 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies whether writeAccelerator should be enabled + /// or disabled on the disk. + /// + [JsonProperty(PropertyName = "writeAcceleratorEnabled")] + public bool? WriteAcceleratorEnabled { get; set; } + + /// + /// Gets or sets specifies the size of an empty data disk in gigabytes. + /// This element can be used to overwrite the size of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; + /// diskSizeGB is the number of bytes x 1024^3 for the disk and the + /// value cannot be larger than 1023 + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets the Source User Image VirtualHardDisk. This + /// VirtualHardDisk will be copied before using it to attach to the + /// Virtual Machine. If SourceImage is provided, the destination + /// VirtualHardDisk should not exist. + /// + [JsonProperty(PropertyName = "image")] + public VirtualHardDisk Image { get; set; } + + /// + /// Gets or sets the list of virtual hard disk container uris. + /// + [JsonProperty(PropertyName = "vhdContainers")] + public IList VhdContainers { get; set; } + + /// + /// Gets or sets the managed disk parameters. + /// + [JsonProperty(PropertyName = "managedDisk")] + public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + + /// + /// Gets or sets specifies whether OS Disk should be deleted or + /// detached upon VMSS Flex deletion (This feature is available for + /// VMSS with Flexible OrchestrationMode only). + /// &lt;br&gt;&lt;br&gt; Possible values: + /// &lt;br&gt;&lt;br&gt; **Delete** If this value is + /// used, the OS disk is deleted when VMSS Flex VM is + /// deleted.&lt;br&gt;&lt;br&gt; **Detach** If this + /// value is used, the OS disk is retained after VMSS Flex VM is + /// deleted. &lt;br&gt;&lt;br&gt; The default value is + /// set to **Delete**. For an Ephemeral OS Disk, the default value is + /// set to **Delete**. User cannot change the delete option for + /// Ephemeral OS Disk. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "deleteOption")] + public string DeleteOption { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs new file mode 100644 index 000000000000..48d6b2034fef --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set OS profile. + /// + public partial class VirtualMachineScaleSetUpdateOSProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSProfile class. + /// + public VirtualMachineScaleSetUpdateOSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateOSProfile class. + /// + /// A base-64 encoded string of custom + /// data. + /// The Windows Configuration of the + /// OS profile. + /// The Linux Configuration of the OS + /// profile. + /// The List of certificates for addition to the + /// VM. + public VirtualMachineScaleSetUpdateOSProfile(string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList)) + { + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a base-64 encoded string of custom data. + /// + [JsonProperty(PropertyName = "customData")] + public string CustomData { get; set; } + + /// + /// Gets or sets the Windows Configuration of the OS profile. + /// + [JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration { get; set; } + + /// + /// Gets or sets the Linux Configuration of the OS profile. + /// + [JsonProperty(PropertyName = "linuxConfiguration")] + public LinuxConfiguration LinuxConfiguration { get; set; } + + /// + /// Gets or sets the List of certificates for addition to the VM. + /// + [JsonProperty(PropertyName = "secrets")] + public IList Secrets { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs new file mode 100644 index 000000000000..ec3945e12369 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machines scale set IP Configuration's + /// PublicIPAddress configuration + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration class. + /// + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration class. + /// + /// The publicIP address configuration name. + /// The idle timeout of the public + /// IP address. + /// The dns settings to be applied on the + /// publicIP addresses . + /// The PublicIPPrefix from which to + /// allocate publicIP addresses. + /// Specify what happens to the public IP + /// when the VM is deleted. Possible values include: 'Delete', + /// 'Detach' + public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(string name = default(string), int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings), SubResource publicIPPrefix = default(SubResource), string deleteOption = default(string)) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + PublicIPPrefix = publicIPPrefix; + DeleteOption = deleteOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the publicIP address configuration name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the idle timeout of the public IP address. + /// + [JsonProperty(PropertyName = "properties.idleTimeoutInMinutes")] + public int? IdleTimeoutInMinutes { get; set; } + + /// + /// Gets or sets the dns settings to be applied on the publicIP + /// addresses . + /// + [JsonProperty(PropertyName = "properties.dnsSettings")] + public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DnsSettings { get; set; } + + /// + /// Gets or sets the PublicIPPrefix from which to allocate publicIP + /// addresses. + /// + [JsonProperty(PropertyName = "properties.publicIPPrefix")] + public SubResource PublicIPPrefix { get; set; } + + /// + /// Gets or sets specify what happens to the public IP when the VM is + /// deleted. Possible values include: 'Delete', 'Detach' + /// + [JsonProperty(PropertyName = "properties.deleteOption")] + public string DeleteOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DnsSettings != null) + { + DnsSettings.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs new file mode 100644 index 000000000000..a1b87a7f6c9c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set storage profile. + /// + public partial class VirtualMachineScaleSetUpdateStorageProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateStorageProfile class. + /// + public VirtualMachineScaleSetUpdateStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateStorageProfile class. + /// + /// The image reference. + /// The OS disk. + /// The data disks. + public VirtualMachineScaleSetUpdateStorageProfile(ImageReference imageReference = default(ImageReference), VirtualMachineScaleSetUpdateOSDisk osDisk = default(VirtualMachineScaleSetUpdateOSDisk), IList dataDisks = default(IList), string diskControllerType = default(string)) + { + ImageReference = imageReference; + OsDisk = osDisk; + DataDisks = dataDisks; + DiskControllerType = diskControllerType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image reference. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets the OS disk. + /// + [JsonProperty(PropertyName = "osDisk")] + public VirtualMachineScaleSetUpdateOSDisk OsDisk { get; set; } + + /// + /// Gets or sets the data disks. + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// + [JsonProperty(PropertyName = "diskControllerType")] + public string DiskControllerType { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs new file mode 100644 index 000000000000..7dbee4d08536 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetUpdateVMProfile.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machine scale set virtual machine profile. + /// + public partial class VirtualMachineScaleSetUpdateVMProfile + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateVMProfile class. + /// + public VirtualMachineScaleSetUpdateVMProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetUpdateVMProfile class. + /// + /// The virtual machine scale set OS + /// profile. + /// The virtual machine scale set storage + /// profile. + /// The virtual machine scale set network + /// profile. + /// The virtual machine scale set + /// Security profile + /// The virtual machine scale set + /// diagnostics profile. + /// The virtual machine scale set + /// extension profile. + /// The license type, which is for bring your + /// own license scenario. + /// Specifies the billing related details + /// of a Azure Spot VMSS. Minimum api-version: 2019-03-01. + /// Specifies Scheduled Event + /// related configurations. + /// UserData for the VM, which must be base-64 + /// encoded. Customer should not pass any secrets in here. + /// <br><br>Minimum api-version: 2021-03-01 + /// Specifies the hardware profile + /// related details of a scale set. Minimum api-version: + /// 2021-11-01. + public VirtualMachineScaleSetUpdateVMProfile(VirtualMachineScaleSetUpdateOSProfile osProfile = default(VirtualMachineScaleSetUpdateOSProfile), VirtualMachineScaleSetUpdateStorageProfile storageProfile = default(VirtualMachineScaleSetUpdateStorageProfile), VirtualMachineScaleSetUpdateNetworkProfile networkProfile = default(VirtualMachineScaleSetUpdateNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile), string userData = default(string), VirtualMachineScaleSetHardwareProfile hardwareProfile = default(VirtualMachineScaleSetHardwareProfile)) + { + OsProfile = osProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + ExtensionProfile = extensionProfile; + LicenseType = licenseType; + BillingProfile = billingProfile; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + HardwareProfile = hardwareProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set OS profile. + /// + [JsonProperty(PropertyName = "osProfile")] + public VirtualMachineScaleSetUpdateOSProfile OsProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set storage profile. + /// + [JsonProperty(PropertyName = "storageProfile")] + public VirtualMachineScaleSetUpdateStorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set network profile. + /// + [JsonProperty(PropertyName = "networkProfile")] + public VirtualMachineScaleSetUpdateNetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set Security profile + /// + [JsonProperty(PropertyName = "securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set diagnostics profile. + /// + [JsonProperty(PropertyName = "diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets the virtual machine scale set extension profile. + /// + [JsonProperty(PropertyName = "extensionProfile")] + public VirtualMachineScaleSetExtensionProfile ExtensionProfile { get; set; } + + /// + /// Gets or sets the license type, which is for bring your own license + /// scenario. + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// VMSS. Minimum api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + /// + /// Gets or sets userData for the VM, which must be base-64 encoded. + /// Customer should not pass any secrets in here. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: 2021-03-01 + /// + [JsonProperty(PropertyName = "userData")] + public string UserData { get; set; } + + /// + /// Gets or sets specifies the hardware profile related details of a + /// scale set. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "hardwareProfile")] + public VirtualMachineScaleSetHardwareProfile HardwareProfile { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVM.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVM.cs new file mode 100644 index 000000000000..ff0111e9e36e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVM.cs @@ -0,0 +1,371 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set virtual machine. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVM : Resource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVM class. + /// + public VirtualMachineScaleSetVM() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVM class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The virtual machine instance ID. + /// The virtual machine SKU. + /// Specifies whether the latest model + /// has been applied to the virtual machine. + /// Azure VM unique ID. + /// The virtual machine instance + /// view. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine in the + /// scale set. For instance: whether the virtual machine has the + /// capability to support attaching managed data disks with + /// UltraSSD_LRS storage account type. + /// Specifies the operating system settings for + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the network + /// profile configuration of the virtual machine. + /// Specifies the boot diagnostic + /// settings state. Minimum api-version: 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. An existing VM cannot be added to an availability + /// set. + /// The provisioning state, which only + /// appears in the response. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies whether the model + /// applied to the virtual machine is the model of the virtual machine + /// scale set or the customized model for the virtual machine. + /// Specifies the protection policy of + /// the virtual machine. + /// UserData for the VM, which must be base-64 + /// encoded. Customer should not pass any secrets in here. + /// <br><br>Minimum api-version: 2021-03-01 + /// Specifies the time at which the Virtual + /// Machine resource was created.<br><br>Minimum + /// api-version: 2021-11-01. + /// 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**. + /// The virtual machine child extension + /// resources. + /// The virtual machine zones. + /// The identity of the virtual machine, if + /// configured. + public VirtualMachineScaleSetVM(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string instanceId = default(string), Sku sku = default(Sku), bool? latestModelApplied = default(bool?), string vmId = default(string), VirtualMachineScaleSetVMInstanceView instanceView = default(VirtualMachineScaleSetVMInstanceView), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), SecurityProfile securityProfile = default(SecurityProfile), NetworkProfile networkProfile = default(NetworkProfile), VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default(VirtualMachineScaleSetVMNetworkProfileConfiguration), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), string provisioningState = default(string), string licenseType = default(string), string modelDefinitionApplied = default(string), VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default(VirtualMachineScaleSetVMProtectionPolicy), string userData = default(string), System.DateTime? timeCreated = default(System.DateTime?), Plan plan = default(Plan), IList resources = default(IList), IList zones = default(IList), VirtualMachineIdentity identity = default(VirtualMachineIdentity)) + : base(location, id, name, type, tags) + { + InstanceId = instanceId; + Sku = sku; + LatestModelApplied = latestModelApplied; + VmId = vmId; + InstanceView = instanceView; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + SecurityProfile = securityProfile; + NetworkProfile = networkProfile; + NetworkProfileConfiguration = networkProfileConfiguration; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + ProvisioningState = provisioningState; + LicenseType = licenseType; + ModelDefinitionApplied = modelDefinitionApplied; + ProtectionPolicy = protectionPolicy; + UserData = userData; + TimeCreated = timeCreated; + Plan = plan; + Resources = resources; + Zones = zones; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the virtual machine instance ID. + /// + [JsonProperty(PropertyName = "instanceId")] + public string InstanceId { get; private set; } + + /// + /// Gets the virtual machine SKU. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; private set; } + + /// + /// Gets specifies whether the latest model has been applied to the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.latestModelApplied")] + public bool? LatestModelApplied { get; private set; } + + /// + /// Gets azure VM unique ID. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineScaleSetVMInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine in the scale set. For instance: whether the + /// virtual machine has the capability to support attaching managed + /// data disks with UltraSSD_LRS storage account type. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings for the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the network profile configuration of the + /// virtual machine. + /// + [JsonProperty(PropertyName = "properties.networkProfileConfiguration")] + public VirtualMachineScaleSetVMNetworkProfileConfiguration NetworkProfileConfiguration { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. Minimum + /// api-version: 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. An existing VM cannot be added to an availability set. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets specifies that the image or disk that is being used + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: + /// &lt;br&gt;&lt;br&gt; Windows_Client + /// &lt;br&gt;&lt;br&gt; Windows_Server + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies whether the model applied to the virtual machine is + /// the model of the virtual machine scale set or the customized model + /// for the virtual machine. + /// + [JsonProperty(PropertyName = "properties.modelDefinitionApplied")] + public string ModelDefinitionApplied { get; private set; } + + /// + /// Gets or sets specifies the protection policy of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.protectionPolicy")] + public VirtualMachineScaleSetVMProtectionPolicy ProtectionPolicy { get; set; } + + /// + /// Gets or sets userData for the VM, which must be base-64 encoded. + /// Customer should not pass any secrets in here. + /// &lt;br&gt;&lt;br&gt;Minimum api-version: 2021-03-01 + /// + [JsonProperty(PropertyName = "properties.userData")] + public string UserData { get; set; } + + /// + /// Gets specifies the time at which the Virtual Machine resource was + /// created.&lt;br&gt;&lt;br&gt;Minimum api-version: + /// 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets 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 -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets the virtual machine child extension resources. + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + /// + /// Gets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Gets or sets the identity of the virtual machine, if configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + if (Resources != null) + { + foreach (var element in Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtension.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtension.cs new file mode 100644 index 000000000000..6ae09ab14e23 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtension.cs @@ -0,0 +1,227 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a VMSS VM Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVMExtension : IResource + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtension + /// class. + /// + public VirtualMachineScaleSetVMExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtension + /// class. + /// + /// The name of the extension. + /// Resource type + /// The location of the extension. + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine extension instance + /// view. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + /// Collection of extension + /// names after which this extension needs to be provisioned. + public VirtualMachineScaleSetVMExtension(string name = default(string), string type = default(string), string location = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), string provisioningState = default(string), VirtualMachineExtensionInstanceView instanceView = default(VirtualMachineExtensionInstanceView), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference), IList provisionAfterExtensions = default(IList)) + { + Name = name; + Type = type; + Location = location; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + ProvisioningState = provisioningState; + InstanceView = instanceView; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + ProvisionAfterExtensions = provisionAfterExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the location of the extension. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the virtual machine extension instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineExtensionInstanceView InstanceView { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Gets or sets collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs new file mode 100644 index 000000000000..8337cd87d61f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs @@ -0,0 +1,189 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a VMSS VM Extension. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineScaleSetVMExtensionUpdate : IResource + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionUpdate class. + /// + public VirtualMachineScaleSetVMExtensionUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionUpdate class. + /// + /// The name of the extension. + /// Resource type + /// How the extension handler should be + /// forced to update even if the extension configuration has not + /// changed. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Indicates whether the + /// extension should be automatically upgraded by the platform if there + /// is a newer version of the extension available. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// Indicates whether failures stemming + /// from the extension will be suppressed (Operational failures such as + /// not connecting to the VM will not be suppressed regardless of this + /// value). The default is false. + /// The extensions + /// protected settings that are passed by reference, and consumed from + /// key vault + public VirtualMachineScaleSetVMExtensionUpdate(string name = default(string), string type = default(string), string forceUpdateTag = default(string), string publisher = default(string), string type1 = default(string), string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), bool? enableAutomaticUpgrade = default(bool?), object settings = default(object), object protectedSettings = default(object), bool? suppressFailures = default(bool?), KeyVaultSecretReference protectedSettingsFromKeyVault = default(KeyVaultSecretReference)) + { + Name = name; + Type = type; + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + Type1 = type1; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + SuppressFailures = suppressFailures; + ProtectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets how the extension handler should be forced to update + /// even if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should be + /// automatically upgraded by the platform if there is a newer version + /// of the extension available. + /// + [JsonProperty(PropertyName = "properties.enableAutomaticUpgrade")] + public bool? EnableAutomaticUpgrade { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets or sets indicates whether failures stemming from the extension + /// will be suppressed (Operational failures such as not connecting to + /// the VM will not be suppressed regardless of this value). The + /// default is false. + /// + [JsonProperty(PropertyName = "properties.suppressFailures")] + public bool? SuppressFailures { get; set; } + + /// + /// Gets or sets the extensions protected settings that are passed by + /// reference, and consumed from key vault + /// + [JsonProperty(PropertyName = "properties.protectedSettingsFromKeyVault")] + public KeyVaultSecretReference ProtectedSettingsFromKeyVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProtectedSettingsFromKeyVault != null) + { + ProtectedSettingsFromKeyVault.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs new file mode 100644 index 000000000000..1057fee97b37 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsListResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The List VMSS VM Extension operation response + /// + public partial class VirtualMachineScaleSetVMExtensionsListResult + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsListResult class. + /// + public VirtualMachineScaleSetVMExtensionsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsListResult class. + /// + /// The list of VMSS VM extensions + public VirtualMachineScaleSetVMExtensionsListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of VMSS VM extensions + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs new file mode 100644 index 000000000000..aabf14a4753c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMExtensionsSummary.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Extensions summary for virtual machines of a virtual machine scale set. + /// + public partial class VirtualMachineScaleSetVMExtensionsSummary + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsSummary class. + /// + public VirtualMachineScaleSetVMExtensionsSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMExtensionsSummary class. + /// + /// The extension name. + /// The extensions information. + public VirtualMachineScaleSetVMExtensionsSummary(string name = default(string), IList statusesSummary = default(IList)) + { + Name = name; + StatusesSummary = statusesSummary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the extension name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the extensions information. + /// + [JsonProperty(PropertyName = "statusesSummary")] + public IList StatusesSummary { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs new file mode 100644 index 000000000000..b51892cd4f82 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceIDs.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a list of virtual machine instance IDs from the VM scale set. + /// + public partial class VirtualMachineScaleSetVMInstanceIDs + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceIDs class. + /// + public VirtualMachineScaleSetVMInstanceIDs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceIDs class. + /// + /// 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. + public VirtualMachineScaleSetVMInstanceIDs(IList instanceIds = default(IList)) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs new file mode 100644 index 000000000000..061ad001a64e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceRequiredIDs.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies a list of virtual machine instance IDs from the VM scale set. + /// + public partial class VirtualMachineScaleSetVMInstanceRequiredIDs + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceRequiredIDs class. + /// + public VirtualMachineScaleSetVMInstanceRequiredIDs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceRequiredIDs class. + /// + /// The virtual machine scale set instance + /// ids. + public VirtualMachineScaleSetVMInstanceRequiredIDs(IList instanceIds) + { + InstanceIds = instanceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine scale set instance ids. + /// + [JsonProperty(PropertyName = "instanceIds")] + public IList InstanceIds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InstanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "InstanceIds"); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs new file mode 100644 index 000000000000..0a0d04711bc1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMInstanceView.cs @@ -0,0 +1,217 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The instance view of a virtual machine scale set VM. + /// + public partial class VirtualMachineScaleSetVMInstanceView + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceView class. + /// + public VirtualMachineScaleSetVMInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMInstanceView class. + /// + /// The Update Domain count. + /// The Fault Domain count. + /// The Remote desktop certificate + /// thumbprint. + /// The VM Agent running on the virtual + /// machine. + /// The Maintenance Operation + /// status on the virtual machine. + /// The disks information. + /// The extensions information. + /// The health status for the VM. + /// Boot Diagnostics is a debugging + /// feature which allows you to view Console Output and Screenshot to + /// diagnose VM status. You can easily view the output of your console + /// log. Azure also enables you to see a screenshot of the VM from the + /// hypervisor. + /// The resource status information. + /// Resource id of the dedicated host, on + /// which the virtual machine is allocated through automatic placement, + /// when the virtual machine is associated with a dedicated host group + /// that has automatic placement enabled. Minimum api-version: + /// 2020-06-01. + /// The placement group in which the VM + /// is running. If the VM is deallocated it will not have a + /// placementGroupId. + /// Specifies the host OS name of the + /// virtual machine. <br><br> This name cannot be updated + /// after the VM is created. <br><br> **Max-length + /// (Windows):** 15 characters <br><br> **Max-length + /// (Linux):** 64 characters. <br><br> For naming + /// conventions and restrictions see [Azure infrastructure services + /// implementation + /// guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + /// The Operating System running on the hybrid + /// machine. + /// The version of Operating System running on + /// the hybrid machine. + /// The hypervisor generation of the + /// Virtual Machine [V1, V2]. Possible values include: 'V1', + /// 'V2' + public VirtualMachineScaleSetVMInstanceView(int? platformUpdateDomain = default(int?), int? platformFaultDomain = default(int?), string rdpThumbPrint = default(string), VirtualMachineAgentInstanceView vmAgent = default(VirtualMachineAgentInstanceView), MaintenanceRedeployStatus maintenanceRedeployStatus = default(MaintenanceRedeployStatus), IList disks = default(IList), IList extensions = default(IList), VirtualMachineHealthStatus vmHealth = default(VirtualMachineHealthStatus), BootDiagnosticsInstanceView bootDiagnostics = default(BootDiagnosticsInstanceView), IList statuses = default(IList), string assignedHost = default(string), string placementGroupId = default(string), string computerName = default(string), string osName = default(string), string osVersion = default(string), string hyperVGeneration = default(string)) + { + PlatformUpdateDomain = platformUpdateDomain; + PlatformFaultDomain = platformFaultDomain; + RdpThumbPrint = rdpThumbPrint; + VmAgent = vmAgent; + MaintenanceRedeployStatus = maintenanceRedeployStatus; + Disks = disks; + Extensions = extensions; + VmHealth = vmHealth; + BootDiagnostics = bootDiagnostics; + Statuses = statuses; + AssignedHost = assignedHost; + PlacementGroupId = placementGroupId; + ComputerName = computerName; + OsName = osName; + OsVersion = osVersion; + HyperVGeneration = hyperVGeneration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Update Domain count. + /// + [JsonProperty(PropertyName = "platformUpdateDomain")] + public int? PlatformUpdateDomain { get; set; } + + /// + /// Gets or sets the Fault Domain count. + /// + [JsonProperty(PropertyName = "platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets the Remote desktop certificate thumbprint. + /// + [JsonProperty(PropertyName = "rdpThumbPrint")] + public string RdpThumbPrint { get; set; } + + /// + /// Gets or sets the VM Agent running on the virtual machine. + /// + [JsonProperty(PropertyName = "vmAgent")] + public VirtualMachineAgentInstanceView VmAgent { get; set; } + + /// + /// Gets or sets the Maintenance Operation status on the virtual + /// machine. + /// + [JsonProperty(PropertyName = "maintenanceRedeployStatus")] + public MaintenanceRedeployStatus MaintenanceRedeployStatus { get; set; } + + /// + /// Gets or sets the disks information. + /// + [JsonProperty(PropertyName = "disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets the extensions information. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + /// + /// Gets the health status for the VM. + /// + [JsonProperty(PropertyName = "vmHealth")] + public VirtualMachineHealthStatus VmHealth { get; private set; } + + /// + /// Gets or sets boot Diagnostics is a debugging feature which allows + /// you to view Console Output and Screenshot to diagnose VM status. + /// You can easily view the output of your console log. Azure also + /// enables you to see a screenshot of the VM from the hypervisor. + /// + [JsonProperty(PropertyName = "bootDiagnostics")] + public BootDiagnosticsInstanceView BootDiagnostics { get; set; } + + /// + /// Gets or sets the resource status information. + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + /// + /// Gets resource id of the dedicated host, on which the virtual + /// machine is allocated through automatic placement, when the virtual + /// machine is associated with a dedicated host group that has + /// automatic placement enabled. Minimum api-version: 2020-06-01. + /// + [JsonProperty(PropertyName = "assignedHost")] + public string AssignedHost { get; private set; } + + /// + /// Gets or sets the placement group in which the VM is running. If the + /// VM is deallocated it will not have a placementGroupId. + /// + [JsonProperty(PropertyName = "placementGroupId")] + public string PlacementGroupId { get; set; } + + /// + /// Gets or sets specifies the host OS name of the virtual machine. + /// &lt;br&gt;&lt;br&gt; This name cannot be updated + /// after the VM is created. &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 15 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 64 + /// characters. &lt;br&gt;&lt;br&gt; For naming + /// conventions and restrictions see [Azure infrastructure services + /// implementation + /// guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + /// + [JsonProperty(PropertyName = "computerName")] + public string ComputerName { get; set; } + + /// + /// Gets or sets the Operating System running on the hybrid machine. + /// + [JsonProperty(PropertyName = "osName")] + public string OsName { get; set; } + + /// + /// Gets or sets the version of Operating System running on the hybrid + /// machine. + /// + [JsonProperty(PropertyName = "osVersion")] + public string OsVersion { get; set; } + + /// + /// Gets or sets the hypervisor generation of the Virtual Machine [V1, + /// V2]. Possible values include: 'V1', 'V2' + /// + [JsonProperty(PropertyName = "hyperVGeneration")] + public string HyperVGeneration { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs new file mode 100644 index 000000000000..f8e141cdd2b9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMNetworkProfileConfiguration.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a virtual machine scale set VM network profile. + /// + public partial class VirtualMachineScaleSetVMNetworkProfileConfiguration + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMNetworkProfileConfiguration class. + /// + public VirtualMachineScaleSetVMNetworkProfileConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMNetworkProfileConfiguration class. + /// + /// The list of network + /// configurations. + public VirtualMachineScaleSetVMNetworkProfileConfiguration(IList networkInterfaceConfigurations = default(IList)) + { + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of network configurations. + /// + [JsonProperty(PropertyName = "networkInterfaceConfigurations")] + public IList NetworkInterfaceConfigurations { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProfile.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProfile.cs new file mode 100644 index 000000000000..3f238588513a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProfile.cs @@ -0,0 +1,273 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a virtual machine scale set virtual machine profile. + /// + public partial class VirtualMachineScaleSetVMProfile + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMProfile + /// class. + /// + public VirtualMachineScaleSetVMProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMProfile + /// class. + /// + /// Specifies the operating system settings for + /// the virtual machines in the scale set. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies properties of the network + /// interfaces of the virtual machines in the scale set. + /// Specifies the Security related + /// profile settings for the virtual machines in the scale set. + /// Specifies the boot diagnostic + /// settings state. Minimum api-version: 2015-06-15. + /// Specifies a collection of settings + /// for extensions installed on virtual machines in the scale + /// set. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the priority for the virtual + /// machines in the scale set. Minimum api-version: 2017-10-30-preview. + /// Possible values include: 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. For Azure Spot + /// virtual machines, both 'Deallocate' and 'Delete' are supported and + /// the minimum api-version is 2019-03-01. For Azure Spot scale sets, + /// both 'Deallocate' and 'Delete' are supported and the minimum + /// api-version is 2017-10-30-preview. Possible values include: + /// 'Deallocate', 'Delete' + /// Specifies the billing related details + /// of a Azure Spot VMSS. Minimum api-version: 2019-03-01. + /// Specifies Scheduled Event + /// related configurations. + /// UserData for the virtual machines in the + /// scale set, which must be base-64 encoded. Customer should not pass + /// any secrets in here. Minimum api-version: 2021-03-01. + /// Specifies the capacity + /// reservation related details of a scale set. Minimum api-version: + /// 2021-04-01. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS + /// Specifies the hardware profile + /// related details of a scale set. Minimum api-version: + /// 2021-11-01. + /// Specifies the service + /// artifact reference id used to set same image version for all + /// virtual machines in the scale set when using 'latest' image + /// version. Minimum api-version: 2022-11-01 + /// Specifies the security + /// posture to be used for all virtual machines in the scale set. + /// Minimum api-version: 2023-03-01 + public VirtualMachineScaleSetVMProfile(VirtualMachineScaleSetOSProfile osProfile = default(VirtualMachineScaleSetOSProfile), VirtualMachineScaleSetStorageProfile storageProfile = default(VirtualMachineScaleSetStorageProfile), VirtualMachineScaleSetNetworkProfile networkProfile = default(VirtualMachineScaleSetNetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), VirtualMachineScaleSetExtensionProfile extensionProfile = default(VirtualMachineScaleSetExtensionProfile), string licenseType = default(string), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile), string userData = default(string), CapacityReservationProfile capacityReservation = default(CapacityReservationProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), VirtualMachineScaleSetHardwareProfile hardwareProfile = default(VirtualMachineScaleSetHardwareProfile), ServiceArtifactReference serviceArtifactReference = default(ServiceArtifactReference), SecurityPostureReference securityPostureReference = default(SecurityPostureReference)) + { + OsProfile = osProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + ExtensionProfile = extensionProfile; + LicenseType = licenseType; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + HardwareProfile = hardwareProfile; + ServiceArtifactReference = serviceArtifactReference; + SecurityPostureReference = securityPostureReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the operating system settings for the + /// virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "osProfile")] + public VirtualMachineScaleSetOSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "storageProfile")] + public VirtualMachineScaleSetStorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies properties of the network interfaces of the + /// virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "networkProfile")] + public VirtualMachineScaleSetNetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. Minimum + /// api-version: 2015-06-15. + /// + [JsonProperty(PropertyName = "diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets specifies a collection of settings for extensions + /// installed on virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "extensionProfile")] + public VirtualMachineScaleSetExtensionProfile ExtensionProfile { get; set; } + + /// + /// Gets or sets specifies that the image or disk that is being used + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: + /// &lt;br&gt;&lt;br&gt; Windows_Client + /// &lt;br&gt;&lt;br&gt; Windows_Server + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machines in the + /// scale set. Minimum api-version: 2017-10-30-preview. Possible values + /// include: 'Regular', 'Low', 'Spot' + /// + [JsonProperty(PropertyName = "priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// VMSS. Minimum api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + /// + /// Gets or sets userData for the virtual machines in the scale set, + /// which must be base-64 encoded. Customer should not pass any secrets + /// in here. Minimum api-version: 2021-03-01. + /// + [JsonProperty(PropertyName = "userData")] + public string UserData { get; set; } + + /// + /// Gets or sets specifies the capacity reservation related details of + /// a scale set. Minimum api-version: 2021-04-01. + /// + [JsonProperty(PropertyName = "capacityReservation")] + public CapacityReservationProfile CapacityReservation { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS + /// + [JsonProperty(PropertyName = "applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets or sets specifies the hardware profile related details of a + /// scale set. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "hardwareProfile")] + public VirtualMachineScaleSetHardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the service artifact reference id used to + /// set same image version for all virtual machines in the scale set + /// when using 'latest' image version. Minimum api-version: 2022-11-01 + /// + [JsonProperty(PropertyName = "serviceArtifactReference")] + public ServiceArtifactReference ServiceArtifactReference { get; set; } + + /// + /// Gets or sets specifies the security posture to be used for all + /// virtual machines in the scale set. Minimum api-version: 2023-03-01 + /// + [JsonProperty(PropertyName = "securityPostureReference")] + public SecurityPostureReference SecurityPostureReference { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs new file mode 100644 index 000000000000..73637dcff1c8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMProtectionPolicy.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The protection policy of a virtual machine scale set VM. + /// + public partial class VirtualMachineScaleSetVMProtectionPolicy + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMProtectionPolicy class. + /// + public VirtualMachineScaleSetVMProtectionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMProtectionPolicy class. + /// + /// Indicates that the virtual machine + /// scale set VM shouldn't be considered for deletion during a scale-in + /// operation. + /// Indicates that model + /// updates or actions (including scale-in) initiated on the virtual + /// machine scale set should not be applied to the virtual machine + /// scale set VM. + public VirtualMachineScaleSetVMProtectionPolicy(bool? protectFromScaleIn = default(bool?), bool? protectFromScaleSetActions = default(bool?)) + { + ProtectFromScaleIn = protectFromScaleIn; + ProtectFromScaleSetActions = protectFromScaleSetActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates that the virtual machine scale set VM + /// shouldn't be considered for deletion during a scale-in operation. + /// + [JsonProperty(PropertyName = "protectFromScaleIn")] + public bool? ProtectFromScaleIn { get; set; } + + /// + /// Gets or sets indicates that model updates or actions (including + /// scale-in) initiated on the virtual machine scale set should not be + /// applied to the virtual machine scale set VM. + /// + [JsonProperty(PropertyName = "protectFromScaleSetActions")] + public bool? ProtectFromScaleSetActions { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs new file mode 100644 index 000000000000..94daf2c60c5f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// Describes a Virtual Machine Scale Set VM Reimage Parameters. + /// + public partial class VirtualMachineScaleSetVMReimageParameters : VirtualMachineReimageParameters + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMReimageParameters class. + /// + public VirtualMachineScaleSetVMReimageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetVMReimageParameters class. + /// + /// Specifies whether to reimage temp disk. + /// Default value: false. Note: This temp disk reimage parameter is + /// only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version + /// the OS disk should be reimaged to. If exact version is not + /// provided, the OS disk is reimaged to the existing version of OS + /// Disk. + /// Specifies information required for + /// reimaging the non-ephemeral OS disk. + public VirtualMachineScaleSetVMReimageParameters(bool? tempDisk = default(bool?), string exactVersion = default(string), OSProfileProvisioningData osProfile = default(OSProfileProvisioningData)) + : base(tempDisk, exactVersion, osProfile) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetsReapplyHeaders.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetsReapplyHeaders.cs new file mode 100644 index 000000000000..4ac7cf0ab688 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineScaleSetsReapplyHeaders.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Reapply operation. + /// + public partial class VirtualMachineScaleSetsReapplyHeaders + { + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetsReapplyHeaders class. + /// + public VirtualMachineScaleSetsReapplyHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineScaleSetsReapplyHeaders class. + /// + public VirtualMachineScaleSetsReapplyHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSize.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSize.cs new file mode 100644 index 000000000000..de774e455703 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSize.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a VM size. + /// + public partial class VirtualMachineSize + { + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + public VirtualMachineSize() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + /// The name of the virtual machine size. + /// The number of cores supported by the + /// virtual machine size. For Constrained vCPU capable VM sizes, this + /// number represents the total vCPUs of quota that the VM uses. For + /// accurate vCPU count, please refer to + /// https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu + /// or + /// https://docs.microsoft.com/rest/api/compute/resourceskus/list + /// The OS disk size, in MB, allowed by + /// the virtual machine size. + /// The resource disk size, in MB, + /// allowed by the virtual machine size. + /// The amount of memory, in MB, supported by + /// the virtual machine size. + /// The maximum number of data disks + /// that can be attached to the virtual machine size. + public VirtualMachineSize(string name = default(string), int? numberOfCores = default(int?), int? osDiskSizeInMB = default(int?), int? resourceDiskSizeInMB = default(int?), int? memoryInMB = default(int?), int? maxDataDiskCount = default(int?)) + { + Name = name; + NumberOfCores = numberOfCores; + OsDiskSizeInMB = osDiskSizeInMB; + ResourceDiskSizeInMB = resourceDiskSizeInMB; + MemoryInMB = memoryInMB; + MaxDataDiskCount = maxDataDiskCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the virtual machine size. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of cores supported by the virtual machine + /// size. For Constrained vCPU capable VM sizes, this number represents + /// the total vCPUs of quota that the VM uses. For accurate vCPU count, + /// please refer to + /// https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu + /// or https://docs.microsoft.com/rest/api/compute/resourceskus/list + /// + [JsonProperty(PropertyName = "numberOfCores")] + public int? NumberOfCores { get; set; } + + /// + /// Gets or sets the OS disk size, in MB, allowed by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "osDiskSizeInMB")] + public int? OsDiskSizeInMB { get; set; } + + /// + /// Gets or sets the resource disk size, in MB, allowed by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "resourceDiskSizeInMB")] + public int? ResourceDiskSizeInMB { get; set; } + + /// + /// Gets or sets the amount of memory, in MB, supported by the virtual + /// machine size. + /// + [JsonProperty(PropertyName = "memoryInMB")] + public int? MemoryInMB { get; set; } + + /// + /// Gets or sets the maximum number of data disks that can be attached + /// to the virtual machine size. + /// + [JsonProperty(PropertyName = "maxDataDiskCount")] + public int? MaxDataDiskCount { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSizeTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSizeTypes.cs new file mode 100644 index 000000000000..4b45aed4c4e6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSizeTypes.cs @@ -0,0 +1,186 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachineSizeTypes. + /// + public static class VirtualMachineSizeTypes + { + public const string BasicA0 = "Basic_A0"; + public const string BasicA1 = "Basic_A1"; + public const string BasicA2 = "Basic_A2"; + public const string BasicA3 = "Basic_A3"; + public const string BasicA4 = "Basic_A4"; + public const string StandardA0 = "Standard_A0"; + public const string StandardA1 = "Standard_A1"; + public const string StandardA2 = "Standard_A2"; + public const string StandardA3 = "Standard_A3"; + public const string StandardA4 = "Standard_A4"; + public const string StandardA5 = "Standard_A5"; + public const string StandardA6 = "Standard_A6"; + public const string StandardA7 = "Standard_A7"; + public const string StandardA8 = "Standard_A8"; + public const string StandardA9 = "Standard_A9"; + public const string StandardA10 = "Standard_A10"; + public const string StandardA11 = "Standard_A11"; + public const string StandardA1V2 = "Standard_A1_v2"; + public const string StandardA2V2 = "Standard_A2_v2"; + public const string StandardA4V2 = "Standard_A4_v2"; + public const string StandardA8V2 = "Standard_A8_v2"; + public const string StandardA2mV2 = "Standard_A2m_v2"; + public const string StandardA4mV2 = "Standard_A4m_v2"; + public const string StandardA8mV2 = "Standard_A8m_v2"; + public const string StandardB1s = "Standard_B1s"; + public const string StandardB1ms = "Standard_B1ms"; + public const string StandardB2s = "Standard_B2s"; + public const string StandardB2ms = "Standard_B2ms"; + public const string StandardB4ms = "Standard_B4ms"; + public const string StandardB8ms = "Standard_B8ms"; + public const string StandardD1 = "Standard_D1"; + public const string StandardD2 = "Standard_D2"; + public const string StandardD3 = "Standard_D3"; + public const string StandardD4 = "Standard_D4"; + public const string StandardD11 = "Standard_D11"; + public const string StandardD12 = "Standard_D12"; + public const string StandardD13 = "Standard_D13"; + public const string StandardD14 = "Standard_D14"; + public const string StandardD1V2 = "Standard_D1_v2"; + public const string StandardD2V2 = "Standard_D2_v2"; + public const string StandardD3V2 = "Standard_D3_v2"; + public const string StandardD4V2 = "Standard_D4_v2"; + public const string StandardD5V2 = "Standard_D5_v2"; + public const string StandardD2V3 = "Standard_D2_v3"; + public const string StandardD4V3 = "Standard_D4_v3"; + public const string StandardD8V3 = "Standard_D8_v3"; + public const string StandardD16V3 = "Standard_D16_v3"; + public const string StandardD32V3 = "Standard_D32_v3"; + public const string StandardD64V3 = "Standard_D64_v3"; + public const string StandardD2sV3 = "Standard_D2s_v3"; + public const string StandardD4sV3 = "Standard_D4s_v3"; + public const string StandardD8sV3 = "Standard_D8s_v3"; + public const string StandardD16sV3 = "Standard_D16s_v3"; + public const string StandardD32sV3 = "Standard_D32s_v3"; + public const string StandardD64sV3 = "Standard_D64s_v3"; + public const string StandardD11V2 = "Standard_D11_v2"; + public const string StandardD12V2 = "Standard_D12_v2"; + public const string StandardD13V2 = "Standard_D13_v2"; + public const string StandardD14V2 = "Standard_D14_v2"; + public const string StandardD15V2 = "Standard_D15_v2"; + public const string StandardDS1 = "Standard_DS1"; + public const string StandardDS2 = "Standard_DS2"; + public const string StandardDS3 = "Standard_DS3"; + public const string StandardDS4 = "Standard_DS4"; + public const string StandardDS11 = "Standard_DS11"; + public const string StandardDS12 = "Standard_DS12"; + public const string StandardDS13 = "Standard_DS13"; + public const string StandardDS14 = "Standard_DS14"; + public const string StandardDS1V2 = "Standard_DS1_v2"; + public const string StandardDS2V2 = "Standard_DS2_v2"; + public const string StandardDS3V2 = "Standard_DS3_v2"; + public const string StandardDS4V2 = "Standard_DS4_v2"; + public const string StandardDS5V2 = "Standard_DS5_v2"; + public const string StandardDS11V2 = "Standard_DS11_v2"; + public const string StandardDS12V2 = "Standard_DS12_v2"; + public const string StandardDS13V2 = "Standard_DS13_v2"; + public const string StandardDS14V2 = "Standard_DS14_v2"; + public const string StandardDS15V2 = "Standard_DS15_v2"; + public const string StandardDS134V2 = "Standard_DS13-4_v2"; + public const string StandardDS132V2 = "Standard_DS13-2_v2"; + public const string StandardDS148V2 = "Standard_DS14-8_v2"; + public const string StandardDS144V2 = "Standard_DS14-4_v2"; + public const string StandardE2V3 = "Standard_E2_v3"; + public const string StandardE4V3 = "Standard_E4_v3"; + public const string StandardE8V3 = "Standard_E8_v3"; + public const string StandardE16V3 = "Standard_E16_v3"; + public const string StandardE32V3 = "Standard_E32_v3"; + public const string StandardE64V3 = "Standard_E64_v3"; + public const string StandardE2sV3 = "Standard_E2s_v3"; + public const string StandardE4sV3 = "Standard_E4s_v3"; + public const string StandardE8sV3 = "Standard_E8s_v3"; + public const string StandardE16sV3 = "Standard_E16s_v3"; + public const string StandardE32sV3 = "Standard_E32s_v3"; + public const string StandardE64sV3 = "Standard_E64s_v3"; + public const string StandardE3216V3 = "Standard_E32-16_v3"; + public const string StandardE328sV3 = "Standard_E32-8s_v3"; + public const string StandardE6432sV3 = "Standard_E64-32s_v3"; + public const string StandardE6416sV3 = "Standard_E64-16s_v3"; + public const string StandardF1 = "Standard_F1"; + public const string StandardF2 = "Standard_F2"; + public const string StandardF4 = "Standard_F4"; + public const string StandardF8 = "Standard_F8"; + public const string StandardF16 = "Standard_F16"; + public const string StandardF1s = "Standard_F1s"; + public const string StandardF2s = "Standard_F2s"; + public const string StandardF4s = "Standard_F4s"; + public const string StandardF8s = "Standard_F8s"; + public const string StandardF16s = "Standard_F16s"; + public const string StandardF2sV2 = "Standard_F2s_v2"; + public const string StandardF4sV2 = "Standard_F4s_v2"; + public const string StandardF8sV2 = "Standard_F8s_v2"; + public const string StandardF16sV2 = "Standard_F16s_v2"; + public const string StandardF32sV2 = "Standard_F32s_v2"; + public const string StandardF64sV2 = "Standard_F64s_v2"; + public const string StandardF72sV2 = "Standard_F72s_v2"; + public const string StandardG1 = "Standard_G1"; + public const string StandardG2 = "Standard_G2"; + public const string StandardG3 = "Standard_G3"; + public const string StandardG4 = "Standard_G4"; + public const string StandardG5 = "Standard_G5"; + public const string StandardGS1 = "Standard_GS1"; + public const string StandardGS2 = "Standard_GS2"; + public const string StandardGS3 = "Standard_GS3"; + public const string StandardGS4 = "Standard_GS4"; + public const string StandardGS5 = "Standard_GS5"; + public const string StandardGS48 = "Standard_GS4-8"; + public const string StandardGS44 = "Standard_GS4-4"; + public const string StandardGS516 = "Standard_GS5-16"; + public const string StandardGS58 = "Standard_GS5-8"; + public const string StandardH8 = "Standard_H8"; + public const string StandardH16 = "Standard_H16"; + public const string StandardH8m = "Standard_H8m"; + public const string StandardH16m = "Standard_H16m"; + public const string StandardH16r = "Standard_H16r"; + public const string StandardH16mr = "Standard_H16mr"; + public const string StandardL4s = "Standard_L4s"; + public const string StandardL8s = "Standard_L8s"; + public const string StandardL16s = "Standard_L16s"; + public const string StandardL32s = "Standard_L32s"; + public const string StandardM64s = "Standard_M64s"; + public const string StandardM64ms = "Standard_M64ms"; + public const string StandardM128s = "Standard_M128s"; + public const string StandardM128ms = "Standard_M128ms"; + public const string StandardM6432ms = "Standard_M64-32ms"; + public const string StandardM6416ms = "Standard_M64-16ms"; + public const string StandardM12864ms = "Standard_M128-64ms"; + public const string StandardM12832ms = "Standard_M128-32ms"; + public const string StandardNC6 = "Standard_NC6"; + public const string StandardNC12 = "Standard_NC12"; + public const string StandardNC24 = "Standard_NC24"; + public const string StandardNC24r = "Standard_NC24r"; + public const string StandardNC6sV2 = "Standard_NC6s_v2"; + public const string StandardNC12sV2 = "Standard_NC12s_v2"; + public const string StandardNC24sV2 = "Standard_NC24s_v2"; + public const string StandardNC24rsV2 = "Standard_NC24rs_v2"; + public const string StandardNC6sV3 = "Standard_NC6s_v3"; + public const string StandardNC12sV3 = "Standard_NC12s_v3"; + public const string StandardNC24sV3 = "Standard_NC24s_v3"; + public const string StandardNC24rsV3 = "Standard_NC24rs_v3"; + public const string StandardND6s = "Standard_ND6s"; + public const string StandardND12s = "Standard_ND12s"; + public const string StandardND24s = "Standard_ND24s"; + public const string StandardND24rs = "Standard_ND24rs"; + public const string StandardNV6 = "Standard_NV6"; + public const string StandardNV12 = "Standard_NV12"; + public const string StandardNV24 = "Standard_NV24"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSoftwarePatchProperties.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSoftwarePatchProperties.cs new file mode 100644 index 000000000000..bc709ce1f948 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineSoftwarePatchProperties.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the properties of a Virtual Machine software patch. + /// + public partial class VirtualMachineSoftwarePatchProperties + { + /// + /// Initializes a new instance of the + /// VirtualMachineSoftwarePatchProperties class. + /// + public VirtualMachineSoftwarePatchProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualMachineSoftwarePatchProperties class. + /// + /// A unique identifier for the patch. + /// The friendly name of the patch. + /// The version number of the patch. This + /// property applies only to Linux patches. + /// The KBID of the patch. Only applies to Windows + /// patches. + /// The classification(s) of the patch as + /// provided by the patch publisher. + /// Describes the reboot requirements of + /// the patch. Possible values include: 'Unknown', 'NeverReboots', + /// 'AlwaysRequiresReboot', 'CanRequestReboot' + /// The activity ID of the operation that + /// produced this result. It is used to correlate across CRP and + /// extension logs. + /// The UTC timestamp when the repository + /// published this patch. + /// The UTC timestamp of the last + /// update to this patch record. + /// Describes the availability of a given + /// patch. Possible values include: 'Unknown', 'Available' + public VirtualMachineSoftwarePatchProperties(string patchId = default(string), string name = default(string), string version = default(string), string kbId = default(string), IList classifications = default(IList), string rebootBehavior = default(string), string activityId = default(string), System.DateTime? publishedDate = default(System.DateTime?), System.DateTime? lastModifiedDateTime = default(System.DateTime?), string assessmentState = default(string)) + { + PatchId = patchId; + Name = name; + Version = version; + KbId = kbId; + Classifications = classifications; + RebootBehavior = rebootBehavior; + ActivityId = activityId; + PublishedDate = publishedDate; + LastModifiedDateTime = lastModifiedDateTime; + AssessmentState = assessmentState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique identifier for the patch. + /// + [JsonProperty(PropertyName = "patchId")] + public string PatchId { get; private set; } + + /// + /// Gets the friendly name of the patch. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the version number of the patch. This property applies only to + /// Linux patches. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + /// + /// Gets the KBID of the patch. Only applies to Windows patches. + /// + [JsonProperty(PropertyName = "kbId")] + public string KbId { get; private set; } + + /// + /// Gets the classification(s) of the patch as provided by the patch + /// publisher. + /// + [JsonProperty(PropertyName = "classifications")] + public IList Classifications { get; private set; } + + /// + /// Gets describes the reboot requirements of the patch. Possible + /// values include: 'Unknown', 'NeverReboots', 'AlwaysRequiresReboot', + /// 'CanRequestReboot' + /// + [JsonProperty(PropertyName = "rebootBehavior")] + public string RebootBehavior { get; private set; } + + /// + /// Gets the activity ID of the operation that produced this result. It + /// is used to correlate across CRP and extension logs. + /// + [JsonProperty(PropertyName = "activityId")] + public string ActivityId { get; private set; } + + /// + /// Gets the UTC timestamp when the repository published this patch. + /// + [JsonProperty(PropertyName = "publishedDate")] + public System.DateTime? PublishedDate { get; private set; } + + /// + /// Gets the UTC timestamp of the last update to this patch record. + /// + [JsonProperty(PropertyName = "lastModifiedDateTime")] + public System.DateTime? LastModifiedDateTime { get; private set; } + + /// + /// Gets describes the availability of a given patch. Possible values + /// include: 'Unknown', 'Available' + /// + [JsonProperty(PropertyName = "assessmentState")] + public string AssessmentState { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineStatusCodeCount.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineStatusCodeCount.cs new file mode 100644 index 000000000000..3c614f4e1aac --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineStatusCodeCount.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The status code and count of the virtual machine scale set instance + /// view status summary. + /// + public partial class VirtualMachineStatusCodeCount + { + /// + /// Initializes a new instance of the VirtualMachineStatusCodeCount + /// class. + /// + public VirtualMachineStatusCodeCount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineStatusCodeCount + /// class. + /// + /// The instance view status code. + /// The number of instances having a particular + /// status code. + public VirtualMachineStatusCodeCount(string code = default(string), int? count = default(int?)) + { + Code = code; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the instance view status code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the number of instances having a particular status code. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; private set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineUpdate.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineUpdate.cs new file mode 100644 index 000000000000..e25d5678d1ed --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VirtualMachineUpdate.cs @@ -0,0 +1,474 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a Virtual Machine Update. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualMachineUpdate : UpdateResource + { + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + public VirtualMachineUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineUpdate class. + /// + /// Resource tags + /// 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**. + /// Specifies the hardware settings for + /// the virtual machine. + /// Specifies the storage settings for the + /// virtual machine disks. + /// Specifies additional + /// capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings + /// used while creating the virtual machine. Some of the settings + /// cannot be changed once VM is provisioned. + /// Specifies the network interfaces of + /// the virtual machine. + /// Specifies the Security related + /// profile settings for the virtual machine. + /// Specifies the boot diagnostic + /// settings state. Minimum api-version: 2015-06-15. + /// 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. The availability set to which the VM is being added should be + /// under the same resource group as the availability set resource. An + /// existing VM cannot be added to an availability set. This property + /// cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// Specifies information about + /// the virtual machine scale set that the virtual machine should be + /// assigned to. Virtual machines specified in the same virtual machine + /// scale set are allocated to different nodes to maximize + /// availability. Currently, a VM can only be added to virtual machine + /// scale set at creation time. An existing VM cannot be added to a + /// virtual machine scale set. This property cannot exist along with a + /// non-null properties.availabilitySet reference. Minimum api‐version: + /// 2019‐03‐01. + /// Specifies information about + /// the proximity placement group that the virtual machine should be + /// assigned to. Minimum api-version: 2018-04-01. + /// Specifies the priority for the virtual + /// machine. Minimum api-version: 2019-03-01. Possible values include: + /// 'Regular', 'Low', 'Spot' + /// Specifies the eviction policy for the + /// Azure Spot virtual machine and Azure Spot scale set. For Azure Spot + /// virtual machines, both 'Deallocate' and 'Delete' are supported and + /// the minimum api-version is 2019-03-01. For Azure Spot scale sets, + /// both 'Deallocate' and 'Delete' are supported and the minimum + /// api-version is 2017-10-30-preview. Possible values include: + /// 'Deallocate', 'Delete' + /// Specifies the billing related details + /// of a Azure Spot virtual machine. Minimum api-version: + /// 2019-03-01. + /// Specifies information about the dedicated host + /// that the virtual machine resides in. Minimum api-version: + /// 2018-10-01. + /// Specifies information about the dedicated + /// host group that the virtual machine resides in. **Note:** User + /// cannot specify both host and hostGroup properties. Minimum + /// api-version: 2020-06-01. + /// The provisioning state, which only + /// appears in the response. + /// The virtual machine instance + /// view. + /// Specifies that the image or disk that is + /// being used was licensed on-premises. <br><br> Possible + /// values for Windows Server operating system are: + /// <br><br> Windows_Client <br><br> + /// Windows_Server <br><br> Possible values for Linux + /// Server operating system are: <br><br> RHEL_BYOS (for + /// RHEL) <br><br> SLES_BYOS (for SUSE) + /// <br><br> For more information, see [Azure Hybrid Use + /// Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// <br><br> [Azure Hybrid Use Benefit for Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// <br><br> Minimum api-version: 2015-06-15 + /// Specifies the VM unique ID which is a 128-bits + /// identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + /// and can be read using platform BIOS commands. + /// 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. + /// Specifies the scale set logical + /// fault domain into which the Virtual Machine will be created. By + /// default, the Virtual Machine will by automatically assigned to a + /// fault domain that best maintains balance across available fault + /// domains. This is applicable only if the 'virtualMachineScaleSet' + /// property of this Virtual Machine is set. The Virtual Machine Scale + /// Set that is referenced, must have 'platformFaultDomainCount' + /// greater than 1. This property cannot be updated once the Virtual + /// Machine is created. Fault domain assignment can be viewed in the + /// Virtual Machine Instance View. Minimum api‐version: + /// 2020‐12‐01. + /// Specifies Scheduled Event + /// related configurations. + /// UserData for the VM, which must be base-64 + /// encoded. Customer should not pass any secrets in here. Minimum + /// api-version: 2021-03-01. + /// Specifies information about the + /// capacity reservation that is used to allocate virtual machine. + /// Minimum api-version: 2021-04-01. + /// Specifies the gallery applications + /// that should be made available to the VM/VMSS. + /// Specifies the time at which the Virtual + /// Machine resource was created. Minimum api-version: + /// 2021-11-01. + /// The identity of the virtual machine, if + /// configured. + /// The virtual machine zones. + public VirtualMachineUpdate(IDictionary tags = default(IDictionary), Plan plan = default(Plan), HardwareProfile hardwareProfile = default(HardwareProfile), StorageProfile storageProfile = default(StorageProfile), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), OSProfile osProfile = default(OSProfile), NetworkProfile networkProfile = default(NetworkProfile), SecurityProfile securityProfile = default(SecurityProfile), DiagnosticsProfile diagnosticsProfile = default(DiagnosticsProfile), SubResource availabilitySet = default(SubResource), SubResource virtualMachineScaleSet = default(SubResource), SubResource proximityPlacementGroup = default(SubResource), string priority = default(string), string evictionPolicy = default(string), BillingProfile billingProfile = default(BillingProfile), SubResource host = default(SubResource), SubResource hostGroup = default(SubResource), string provisioningState = default(string), VirtualMachineInstanceView instanceView = default(VirtualMachineInstanceView), string licenseType = default(string), string vmId = default(string), string extensionsTimeBudget = default(string), int? platformFaultDomain = default(int?), ScheduledEventsProfile scheduledEventsProfile = default(ScheduledEventsProfile), string userData = default(string), CapacityReservationProfile capacityReservation = default(CapacityReservationProfile), ApplicationProfile applicationProfile = default(ApplicationProfile), System.DateTime? timeCreated = default(System.DateTime?), VirtualMachineIdentity identity = default(VirtualMachineIdentity), IList zones = default(IList)) + : base(tags) + { + Plan = plan; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OsProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + TimeCreated = timeCreated; + Identity = identity; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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 -&gt;**. + /// Enter any required information and then click **Save**. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets or sets specifies the hardware settings for the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.hardwareProfile")] + public HardwareProfile HardwareProfile { get; set; } + + /// + /// Gets or sets specifies the storage settings for the virtual machine + /// disks. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets specifies additional capabilities enabled or disabled + /// on the virtual machine. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public AdditionalCapabilities AdditionalCapabilities { get; set; } + + /// + /// Gets or sets specifies the operating system settings used while + /// creating the virtual machine. Some of the settings cannot be + /// changed once VM is provisioned. + /// + [JsonProperty(PropertyName = "properties.osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Gets or sets specifies the network interfaces of the virtual + /// machine. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets specifies the Security related profile settings for + /// the virtual machine. + /// + [JsonProperty(PropertyName = "properties.securityProfile")] + public SecurityProfile SecurityProfile { get; set; } + + /// + /// Gets or sets specifies the boot diagnostic settings state. Minimum + /// api-version: 2015-06-15. + /// + [JsonProperty(PropertyName = "properties.diagnosticsProfile")] + public DiagnosticsProfile DiagnosticsProfile { get; set; } + + /// + /// Gets or sets 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 [Availability sets + /// overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + /// For more information on Azure planned maintenance, see [Maintenance + /// and updates for Virtual Machines in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). + /// Currently, a VM can only be added to availability set at creation + /// time. The availability set to which the VM is being added should be + /// under the same resource group as the availability set resource. An + /// existing VM cannot be added to an availability set. This property + /// cannot exist along with a non-null + /// properties.virtualMachineScaleSet reference. + /// + [JsonProperty(PropertyName = "properties.availabilitySet")] + public SubResource AvailabilitySet { get; set; } + + /// + /// Gets or sets specifies information about the virtual machine scale + /// set that the virtual machine should be assigned to. Virtual + /// machines specified in the same virtual machine scale set are + /// allocated to different nodes to maximize availability. Currently, a + /// VM can only be added to virtual machine scale set at creation time. + /// An existing VM cannot be added to a virtual machine scale set. This + /// property cannot exist along with a non-null + /// properties.availabilitySet reference. Minimum api‐version: + /// 2019‐03‐01. + /// + [JsonProperty(PropertyName = "properties.virtualMachineScaleSet")] + public SubResource VirtualMachineScaleSet { get; set; } + + /// + /// Gets or sets specifies information about the proximity placement + /// group that the virtual machine should be assigned to. Minimum + /// api-version: 2018-04-01. + /// + [JsonProperty(PropertyName = "properties.proximityPlacementGroup")] + public SubResource ProximityPlacementGroup { get; set; } + + /// + /// Gets or sets specifies the priority for the virtual machine. + /// Minimum api-version: 2019-03-01. Possible values include: + /// 'Regular', 'Low', 'Spot' + /// + [JsonProperty(PropertyName = "properties.priority")] + public string Priority { get; set; } + + /// + /// Gets or sets specifies the eviction policy for the Azure Spot + /// virtual machine and Azure Spot scale set. For Azure Spot virtual + /// machines, both 'Deallocate' and 'Delete' are supported and the + /// minimum api-version is 2019-03-01. For Azure Spot scale sets, both + /// 'Deallocate' and 'Delete' are supported and the minimum api-version + /// is 2017-10-30-preview. Possible values include: 'Deallocate', + /// 'Delete' + /// + [JsonProperty(PropertyName = "properties.evictionPolicy")] + public string EvictionPolicy { get; set; } + + /// + /// Gets or sets specifies the billing related details of a Azure Spot + /// virtual machine. Minimum api-version: 2019-03-01. + /// + [JsonProperty(PropertyName = "properties.billingProfile")] + public BillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host that + /// the virtual machine resides in. Minimum api-version: 2018-10-01. + /// + [JsonProperty(PropertyName = "properties.host")] + public SubResource Host { get; set; } + + /// + /// Gets or sets specifies information about the dedicated host group + /// that the virtual machine resides in. **Note:** User cannot specify + /// both host and hostGroup properties. Minimum api-version: + /// 2020-06-01. + /// + [JsonProperty(PropertyName = "properties.hostGroup")] + public SubResource HostGroup { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the virtual machine instance view. + /// + [JsonProperty(PropertyName = "properties.instanceView")] + public VirtualMachineInstanceView InstanceView { get; private set; } + + /// + /// Gets or sets specifies that the image or disk that is being used + /// was licensed on-premises. &lt;br&gt;&lt;br&gt; + /// Possible values for Windows Server operating system are: + /// &lt;br&gt;&lt;br&gt; Windows_Client + /// &lt;br&gt;&lt;br&gt; Windows_Server + /// &lt;br&gt;&lt;br&gt; Possible values for Linux + /// Server operating system are: &lt;br&gt;&lt;br&gt; + /// RHEL_BYOS (for RHEL) &lt;br&gt;&lt;br&gt; SLES_BYOS + /// (for SUSE) &lt;br&gt;&lt;br&gt; For more + /// information, see [Azure Hybrid Use Benefit for Windows + /// Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + /// &lt;br&gt;&lt;br&gt; [Azure Hybrid Use Benefit for + /// Linux + /// Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + /// &lt;br&gt;&lt;br&gt; Minimum api-version: + /// 2015-06-15 + /// + [JsonProperty(PropertyName = "properties.licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets specifies the VM unique ID which is a 128-bits identifier that + /// is encoded and stored in all Azure IaaS VMs SMBIOS and can be read + /// using platform BIOS commands. + /// + [JsonProperty(PropertyName = "properties.vmId")] + public string VmId { get; private set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "properties.extensionsTimeBudget")] + public string ExtensionsTimeBudget { get; set; } + + /// + /// Gets or sets specifies the scale set logical fault domain into + /// which the Virtual Machine will be created. By default, the Virtual + /// Machine will by automatically assigned to a fault domain that best + /// maintains balance across available fault domains. This is + /// applicable only if the 'virtualMachineScaleSet' property of this + /// Virtual Machine is set. The Virtual Machine Scale Set that is + /// referenced, must have 'platformFaultDomainCount' greater than 1. + /// This property cannot be updated once the Virtual Machine is + /// created. Fault domain assignment can be viewed in the Virtual + /// Machine Instance View. Minimum api‐version: 2020‐12‐01. + /// + [JsonProperty(PropertyName = "properties.platformFaultDomain")] + public int? PlatformFaultDomain { get; set; } + + /// + /// Gets or sets specifies Scheduled Event related configurations. + /// + [JsonProperty(PropertyName = "properties.scheduledEventsProfile")] + public ScheduledEventsProfile ScheduledEventsProfile { get; set; } + + /// + /// Gets or sets userData for the VM, which must be base-64 encoded. + /// Customer should not pass any secrets in here. Minimum api-version: + /// 2021-03-01. + /// + [JsonProperty(PropertyName = "properties.userData")] + public string UserData { get; set; } + + /// + /// Gets or sets specifies information about the capacity reservation + /// that is used to allocate virtual machine. Minimum api-version: + /// 2021-04-01. + /// + [JsonProperty(PropertyName = "properties.capacityReservation")] + public CapacityReservationProfile CapacityReservation { get; set; } + + /// + /// Gets or sets specifies the gallery applications that should be made + /// available to the VM/VMSS. + /// + [JsonProperty(PropertyName = "properties.applicationProfile")] + public ApplicationProfile ApplicationProfile { get; set; } + + /// + /// Gets specifies the time at which the Virtual Machine resource was + /// created. Minimum api-version: 2021-11-01. + /// + [JsonProperty(PropertyName = "properties.timeCreated")] + public System.DateTime? TimeCreated { get; private set; } + + /// + /// Gets or sets the identity of the virtual machine, if configured. + /// + [JsonProperty(PropertyName = "identity")] + public VirtualMachineIdentity Identity { get; set; } + + /// + /// Gets or sets the virtual machine zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageProfile != null) + { + StorageProfile.Validate(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VmDiskTypes.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VmDiskTypes.cs new file mode 100644 index 000000000000..6b98cea8d944 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VmDiskTypes.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VmDiskTypes. + /// + public static class VmDiskTypes + { + public const string None = "None"; + public const string Unmanaged = "Unmanaged"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/VmImagesInEdgeZoneListResult.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/VmImagesInEdgeZoneListResult.cs new file mode 100644 index 000000000000..d50f70184049 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/VmImagesInEdgeZoneListResult.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The List VmImages in EdgeZone operation response. + /// + public partial class VmImagesInEdgeZoneListResult + { + /// + /// Initializes a new instance of the VmImagesInEdgeZoneListResult + /// class. + /// + public VmImagesInEdgeZoneListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VmImagesInEdgeZoneListResult + /// class. + /// + /// The list of VMImages in EdgeZone + /// The URI to fetch the next page of VMImages + /// in EdgeZone. Call ListNext() with this URI to fetch the next page + /// of VmImages. + public VmImagesInEdgeZoneListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of VMImages in EdgeZone + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URI to fetch the next page of VMImages in + /// EdgeZone. Call ListNext() with this URI to fetch the next page of + /// VmImages. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMConfiguration.cs new file mode 100644 index 000000000000..2a7f723e723c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMConfiguration.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes Windows Remote Management configuration of the VM + /// + public partial class WinRMConfiguration + { + /// + /// Initializes a new instance of the WinRMConfiguration class. + /// + public WinRMConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WinRMConfiguration class. + /// + /// The list of Windows Remote Management + /// listeners + public WinRMConfiguration(IList listeners = default(IList)) + { + Listeners = listeners; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of Windows Remote Management listeners + /// + [JsonProperty(PropertyName = "listeners")] + public IList Listeners { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMListener.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMListener.cs new file mode 100644 index 000000000000..a7b2f860aee4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WinRMListener.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes Protocol and thumbprint of Windows Remote Management listener + /// + public partial class WinRMListener + { + /// + /// Initializes a new instance of the WinRMListener class. + /// + public WinRMListener() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WinRMListener class. + /// + /// Specifies the protocol of WinRM listener. + /// Possible values are: **http,** **https.**. Possible values include: + /// 'Http', 'Https' + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. For adding a secret to + /// the Key Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be the Base64 encoding of + /// the following JSON Object which is encoded in UTF-8: + /// <br><br> {<br> + /// "data":"<Base64-encoded-certificate>",<br> + /// "dataType":"pfx",<br> + /// "password":"<pfx-file-password>"<br>} <br> To + /// install certificates on a virtual machine it is recommended to use + /// the [Azure Key Vault virtual machine extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + public WinRMListener(ProtocolTypes? protocol = default(ProtocolTypes?), string certificateUrl = default(string)) + { + Protocol = protocol; + CertificateUrl = certificateUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the protocol of WinRM listener. Possible + /// values are: **http,** **https.**. Possible values include: 'Http', + /// 'Https' + /// + [JsonProperty(PropertyName = "protocol")] + public ProtocolTypes? Protocol { get; set; } + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. For adding a secret to the Key + /// Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be the Base64 encoding of + /// the following JSON Object which is encoded in UTF-8: + /// &lt;br&gt;&lt;br&gt; {&lt;br&gt; + /// "data":"&lt;Base64-encoded-certificate&gt;",&lt;br&gt; + /// "dataType":"pfx",&lt;br&gt; + /// "password":"&lt;pfx-file-password&gt;"&lt;br&gt;} + /// &lt;br&gt; To install certificates on a virtual machine it + /// is recommended to use the [Azure Key Vault virtual machine + /// extension for + /// Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + /// or the [Azure Key Vault virtual machine extension for + /// Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsConfiguration.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsConfiguration.cs new file mode 100644 index 000000000000..191e34776a16 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsConfiguration.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies Windows operating system settings on the virtual machine. + /// + public partial class WindowsConfiguration + { + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + public WindowsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + /// Indicates whether virtual machine + /// agent should be provisioned on the virtual machine. When this + /// property is not specified in the request body, it is set to true by + /// default. This will ensure that VM Agent is installed on the VM so + /// that extensions can be added to the VM later. + /// Indicates whether Automatic + /// Updates is enabled for the Windows virtual machine. Default value + /// is true. For virtual machine scale sets, this property can be + /// updated and updates will take effect on OS reprovisioning. + /// Specifies the time zone of the virtual + /// machine. e.g. "Pacific Standard Time". Possible values can be + /// [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + /// value from time zones returned by + /// [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + /// Specifies additional + /// base-64 encoded XML formatted information that can be included in + /// the Unattend.xml file, which is used by Windows Setup. + /// [Preview Feature] Specifies settings + /// related to VM Guest Patching on Windows. + /// Specifies the Windows Remote Management + /// listeners. This enables remote Windows PowerShell. + /// Indicates whether + /// VMAgent Platform Updates is enabled for the Windows virtual + /// machine. Default value is false. + public WindowsConfiguration(bool? provisionVMAgent = default(bool?), bool? enableAutomaticUpdates = default(bool?), string timeZone = default(string), IList additionalUnattendContent = default(IList), PatchSettings patchSettings = default(PatchSettings), WinRMConfiguration winRM = default(WinRMConfiguration), bool? enableVMAgentPlatformUpdates = default(bool?)) + { + ProvisionVMAgent = provisionVMAgent; + EnableAutomaticUpdates = enableAutomaticUpdates; + TimeZone = timeZone; + AdditionalUnattendContent = additionalUnattendContent; + PatchSettings = patchSettings; + WinRM = winRM; + EnableVMAgentPlatformUpdates = enableVMAgentPlatformUpdates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether virtual machine agent should be + /// provisioned on the virtual machine. When this property is not + /// specified in the request body, it is set to true by default. This + /// will ensure that VM Agent is installed on the VM so that extensions + /// can be added to the VM later. + /// + [JsonProperty(PropertyName = "provisionVMAgent")] + public bool? ProvisionVMAgent { get; set; } + + /// + /// Gets or sets indicates whether Automatic Updates is enabled for the + /// Windows virtual machine. Default value is true. For virtual machine + /// scale sets, this property can be updated and updates will take + /// effect on OS reprovisioning. + /// + [JsonProperty(PropertyName = "enableAutomaticUpdates")] + public bool? EnableAutomaticUpdates { get; set; } + + /// + /// Gets or sets specifies the time zone of the virtual machine. e.g. + /// "Pacific Standard Time". Possible values can be + /// [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + /// value from time zones returned by + /// [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets specifies additional base-64 encoded XML formatted + /// information that can be included in the Unattend.xml file, which is + /// used by Windows Setup. + /// + [JsonProperty(PropertyName = "additionalUnattendContent")] + public IList AdditionalUnattendContent { get; set; } + + /// + /// Gets or sets [Preview Feature] Specifies settings related to VM + /// Guest Patching on Windows. + /// + [JsonProperty(PropertyName = "patchSettings")] + public PatchSettings PatchSettings { get; set; } + + /// + /// Gets or sets specifies the Windows Remote Management listeners. + /// This enables remote Windows PowerShell. + /// + [JsonProperty(PropertyName = "winRM")] + public WinRMConfiguration WinRM { get; set; } + + /// + /// Gets or sets indicates whether VMAgent Platform Updates is enabled + /// for the Windows virtual machine. Default value is false. + /// + [JsonProperty(PropertyName = "enableVMAgentPlatformUpdates")] + public bool? EnableVMAgentPlatformUpdates { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsParameters.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsParameters.cs new file mode 100644 index 000000000000..230533edc19d --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsParameters.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Input for InstallPatches on a Windows VM, as directly received by the + /// API + /// + public partial class WindowsParameters + { + /// + /// Initializes a new instance of the WindowsParameters class. + /// + public WindowsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsParameters class. + /// + /// The update classifications + /// to select when installing patches for Windows. + /// Kbs to include in the patch + /// operation + /// Kbs to exclude in the patch + /// operation + /// Filters out Kbs that don't + /// have an InstallationRebootBehavior of 'NeverReboots' when this is + /// set to true. + /// This is used to install patches + /// that were published on or before this given max published + /// date. + public WindowsParameters(IList classificationsToInclude = default(IList), IList kbNumbersToInclude = default(IList), IList kbNumbersToExclude = default(IList), bool? excludeKbsRequiringReboot = default(bool?), System.DateTime? maxPatchPublishDate = default(System.DateTime?)) + { + ClassificationsToInclude = classificationsToInclude; + KbNumbersToInclude = kbNumbersToInclude; + KbNumbersToExclude = kbNumbersToExclude; + ExcludeKbsRequiringReboot = excludeKbsRequiringReboot; + MaxPatchPublishDate = maxPatchPublishDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the update classifications to select when installing + /// patches for Windows. + /// + [JsonProperty(PropertyName = "classificationsToInclude")] + public IList ClassificationsToInclude { get; set; } + + /// + /// Gets or sets kbs to include in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToInclude")] + public IList KbNumbersToInclude { get; set; } + + /// + /// Gets or sets kbs to exclude in the patch operation + /// + [JsonProperty(PropertyName = "kbNumbersToExclude")] + public IList KbNumbersToExclude { get; set; } + + /// + /// Gets or sets filters out Kbs that don't have an + /// InstallationRebootBehavior of 'NeverReboots' when this is set to + /// true. + /// + [JsonProperty(PropertyName = "excludeKbsRequiringReboot")] + public bool? ExcludeKbsRequiringReboot { get; set; } + + /// + /// Gets or sets this is used to install patches that were published on + /// or before this given max published date. + /// + [JsonProperty(PropertyName = "maxPatchPublishDate")] + public System.DateTime? MaxPatchPublishDate { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsPatchAssessmentMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsPatchAssessmentMode.cs new file mode 100644 index 000000000000..04cbb5056aa2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsPatchAssessmentMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for WindowsPatchAssessmentMode. + /// + public static class WindowsPatchAssessmentMode + { + public const string ImageDefault = "ImageDefault"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.cs new file mode 100644 index 000000000000..d4720aae929a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + /// + public static class WindowsVMGuestPatchAutomaticByPlatformRebootSetting + { + public const string Unknown = "Unknown"; + public const string IfRequired = "IfRequired"; + public const string Never = "Never"; + public const string Always = "Always"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformSettings.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformSettings.cs new file mode 100644 index 000000000000..dfc23363798a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchAutomaticByPlatformSettings.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies additional settings to be applied when patch mode + /// AutomaticByPlatform is selected in Windows patch settings. + /// + public partial class WindowsVMGuestPatchAutomaticByPlatformSettings + { + /// + /// Initializes a new instance of the + /// WindowsVMGuestPatchAutomaticByPlatformSettings class. + /// + public WindowsVMGuestPatchAutomaticByPlatformSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// WindowsVMGuestPatchAutomaticByPlatformSettings class. + /// + /// Specifies the reboot setting for all + /// AutomaticByPlatform patch installation operations. Possible values + /// include: 'Unknown', 'IfRequired', 'Never', 'Always' + /// Enables + /// customer to schedule patching without accidental upgrades + public WindowsVMGuestPatchAutomaticByPlatformSettings(string rebootSetting = default(string), bool? bypassPlatformSafetyChecksOnUserSchedule = default(bool?)) + { + RebootSetting = rebootSetting; + BypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the reboot setting for all + /// AutomaticByPlatform patch installation operations. Possible values + /// include: 'Unknown', 'IfRequired', 'Never', 'Always' + /// + [JsonProperty(PropertyName = "rebootSetting")] + public string RebootSetting { get; set; } + + /// + /// Gets or sets enables customer to schedule patching without + /// accidental upgrades + /// + [JsonProperty(PropertyName = "bypassPlatformSafetyChecksOnUserSchedule")] + public bool? BypassPlatformSafetyChecksOnUserSchedule { get; set; } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchMode.cs b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchMode.cs new file mode 100644 index 000000000000..e3c4970c7b0f --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Models/WindowsVMGuestPatchMode.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for WindowsVMGuestPatchMode. + /// + public static class WindowsVMGuestPatchMode + { + public const string Manual = "Manual"; + public const string AutomaticByOS = "AutomaticByOS"; + public const string AutomaticByPlatform = "AutomaticByPlatform"; + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/Operations.cs b/src/Compute/Compute.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..66f729066402 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,219 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a list of compute operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Compute/operations").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/OperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..5f8d049c48f2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/OperationsExtensions.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Gets a list of compute operations. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of compute operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperations.cs new file mode 100644 index 000000000000..2eb48e31f5f6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperations.cs @@ -0,0 +1,1576 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProximityPlacementGroupsOperations operations. + /// + internal partial class ProximityPlacementGroupsOperations : IServiceOperations, IProximityPlacementGroupsOperations + { + /// + /// Initializes a new instance of the ProximityPlacementGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProximityPlacementGroupsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Create or update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + ProximityPlacementGroupUpdate parameters = new ProximityPlacementGroupUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (proximityPlacementGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proximityPlacementGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("proximityPlacementGroupName", proximityPlacementGroupName); + tracingParameters.Add("includeColocationStatus", includeColocationStatus); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{proximityPlacementGroupName}", System.Uri.EscapeDataString(proximityPlacementGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (includeColocationStatus != null) + { + _queryParameters.Add(string.Format("includeColocationStatus={0}", System.Uri.EscapeDataString(includeColocationStatus))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..81148c9ca4c6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ProximityPlacementGroupsOperationsExtensions.cs @@ -0,0 +1,334 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProximityPlacementGroupsOperations. + /// + public static partial class ProximityPlacementGroupsOperationsExtensions + { + /// + /// Create or update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group operation. + /// + public static ProximityPlacementGroup CreateOrUpdate(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Parameters supplied to the Create Proximity Placement Group operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, ProximityPlacementGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + public static ProximityPlacementGroup Update(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, proximityPlacementGroupName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + public static void Delete(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName) + { + operations.DeleteAsync(resourceGroupName, proximityPlacementGroupName).GetAwaiter().GetResult(); + } + + /// + /// Delete a proximity placement group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement group. + /// + public static ProximityPlacementGroup Get(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string)) + { + return operations.GetAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the proximity placement group. + /// + /// + /// includeColocationStatus=true enables fetching the colocation status of all + /// the resources in the proximity placement group. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, string proximityPlacementGroupName, string includeColocationStatus = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IProximityPlacementGroupsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IProximityPlacementGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IProximityPlacementGroupsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IProximityPlacementGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IProximityPlacementGroupsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IProximityPlacementGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IProximityPlacementGroupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all proximity placement groups in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IProximityPlacementGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperations.cs new file mode 100644 index 000000000000..82ca514a3eba --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperations.cs @@ -0,0 +1,420 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ResourceSkusOperations operations. + /// + internal partial class ResourceSkusOperations : IServiceOperations, IResourceSkusOperations + { + /// + /// Initializes a new instance of the ResourceSkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ResourceSkusOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + /// + /// To Include Extended Locations information or not in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string filter = default(string), string includeExtendedLocations = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + tracingParameters.Add("includeExtendedLocations", includeExtendedLocations); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (includeExtendedLocations != null) + { + _queryParameters.Add(string.Format("includeExtendedLocations={0}", System.Uri.EscapeDataString(includeExtendedLocations))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperationsExtensions.cs new file mode 100644 index 000000000000..817c32a97875 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/ResourceSkusOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ResourceSkusOperations. + /// + public static partial class ResourceSkusOperationsExtensions + { + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + /// + /// To Include Extended Locations information or not in the response. + /// + public static IPage List(this IResourceSkusOperations operations, string filter = default(string), string includeExtendedLocations = default(string)) + { + return operations.ListAsync(filter, includeExtendedLocations).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported + /// currently. + /// + /// + /// To Include Extended Locations information or not in the response. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IResourceSkusOperations operations, string filter = default(string), string includeExtendedLocations = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, includeExtendedLocations, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IResourceSkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IResourceSkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperations.cs new file mode 100644 index 000000000000..616e54d93fee --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperations.cs @@ -0,0 +1,1609 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RestorePointCollectionsOperations operations. + /// + internal partial class RestorePointCollectionsOperations : IServiceOperations, IRestorePointCollectionsOperations + { + /// + /// Initializes a new instance of the RestorePointCollectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RestorePointCollectionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the restore point collection. Please + /// refer to https://aka.ms/RestorePoints for more details. When updating a + /// restore point collection, only tags may be modified. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Create or Update restore point collection + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, RestorePointCollection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update the restore point collection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Update restore point collection operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, RestorePointCollectionUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the restore point collection. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The expand expression to apply on the operation. If expand=restorePoints, + /// server will return all contained restore points in the + /// restorePointCollection. Possible values include: 'restorePoints' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperationsExtensions.cs new file mode 100644 index 000000000000..36fa0f5039e8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/RestorePointCollectionsOperationsExtensions.cs @@ -0,0 +1,393 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RestorePointCollectionsOperations. + /// + public static partial class RestorePointCollectionsOperationsExtensions + { + /// + /// The operation to create or update the restore point collection. Please + /// refer to https://aka.ms/RestorePoints for more details. When updating a + /// restore point collection, only tags may be modified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Create or Update restore point collection + /// operation. + /// + public static RestorePointCollection CreateOrUpdate(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, RestorePointCollection parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, restorePointCollectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the restore point collection. Please + /// refer to https://aka.ms/RestorePoints for more details. When updating a + /// restore point collection, only tags may be modified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Create or Update restore point collection + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, RestorePointCollection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the restore point collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Update restore point collection operation. + /// + public static RestorePointCollection Update(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, RestorePointCollectionUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, restorePointCollectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the restore point collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// Parameters supplied to the Update restore point collection operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, RestorePointCollectionUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + public static void Delete(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName) + { + operations.DeleteAsync(resourceGroupName, restorePointCollectionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the restore point collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The expand expression to apply on the operation. If expand=restorePoints, + /// server will return all contained restore points in the + /// restorePointCollection. Possible values include: 'restorePoints' + /// + public static RestorePointCollection Get(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, restorePointCollectionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the restore point collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The expand expression to apply on the operation. If expand=restorePoints, + /// server will return all contained restore points in the + /// restorePointCollection. Possible values include: 'restorePoints' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IRestorePointCollectionsOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this IRestorePointCollectionsOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IRestorePointCollectionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + public static void BeginDelete(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName) + { + operations.BeginDeleteAsync(resourceGroupName, restorePointCollectionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the restore point collection. This operation will + /// also delete all the contained restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IRestorePointCollectionsOperations operations, string resourceGroupName, string restorePointCollectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IRestorePointCollectionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of restore point collections in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IRestorePointCollectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IRestorePointCollectionsOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of restore point collections in the subscription. Use + /// nextLink property in the response to get the next page of restore point + /// collections. Do this till nextLink is not null to fetch all the restore + /// point collections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this IRestorePointCollectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperations.cs new file mode 100644 index 000000000000..b9ae1527473a --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperations.cs @@ -0,0 +1,725 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RestorePointsOperations operations. + /// + internal partial class RestorePointsOperations : IServiceOperations, IRestorePointsOperations + { + /// + /// Initializes a new instance of the RestorePointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RestorePointsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves + /// information about the run-time state of a restore point. Possible values + /// include: 'instanceView' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (restorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointName"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("restorePointName", restorePointName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (restorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("restorePointName", restorePointName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string restorePointCollectionName, string restorePointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (restorePointCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointCollectionName"); + } + if (restorePointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorePointName"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("restorePointCollectionName", restorePointCollectionName); + tracingParameters.Add("restorePointName", restorePointName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{restorePointCollectionName}", System.Uri.EscapeDataString(restorePointCollectionName)); + _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperationsExtensions.cs new file mode 100644 index 000000000000..83dbdacd7df4 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/RestorePointsOperationsExtensions.cs @@ -0,0 +1,275 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RestorePointsOperations. + /// + public static partial class RestorePointsOperationsExtensions + { + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + public static RestorePoint Create(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters) + { + return operations.CreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + public static void Delete(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName) + { + operations.DeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves + /// information about the run-time state of a restore point. Possible values + /// include: 'instanceView' + /// + public static RestorePoint Get(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves + /// information about the run-time state of a restore point. Possible values + /// include: 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + public static RestorePoint BeginCreate(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters) + { + return operations.BeginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create the restore point. Updating properties of an + /// existing restore point is not allowed + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the restore point collection. + /// + /// + /// The name of the restore point. + /// + /// + /// Parameters supplied to the Create restore point operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, RestorePoint parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + public static void BeginDelete(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName) + { + operations.BeginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the restore point. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Restore Point Collection. + /// + /// + /// The name of the restore point. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IRestorePointsOperations operations, string resourceGroupName, string restorePointCollectionName, string restorePointName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, restorePointCollectionName, restorePointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SdkInfo_ComputeManagementClient.cs b/src/Compute/Compute.Management.Sdk/Generated/SdkInfo_ComputeManagementClient.cs new file mode 100644 index 000000000000..5869797f6f7e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SdkInfo_ComputeManagementClient.cs @@ -0,0 +1,75 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ComputeManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Compute", "AvailabilitySets", "2023-07-01"), + new Tuple("Compute", "CapacityReservationGroups", "2023-07-01"), + new Tuple("Compute", "CapacityReservations", "2023-07-01"), + new Tuple("Compute", "CloudServiceOperatingSystems", "2022-09-04"), + new Tuple("Compute", "CloudServiceRoleInstances", "2022-09-04"), + new Tuple("Compute", "CloudServiceRoles", "2022-09-04"), + new Tuple("Compute", "CloudServices", "2022-09-04"), + new Tuple("Compute", "CloudServicesUpdateDomain", "2022-09-04"), + new Tuple("Compute", "CommunityGalleries", "2022-03-03"), + new Tuple("Compute", "CommunityGalleryImageVersions", "2022-03-03"), + new Tuple("Compute", "CommunityGalleryImages", "2022-03-03"), + new Tuple("Compute", "DedicatedHostGroups", "2023-07-01"), + new Tuple("Compute", "DedicatedHosts", "2023-07-01"), + new Tuple("Compute", "DiskAccesses", "2023-04-02"), + new Tuple("Compute", "DiskEncryptionSets", "2023-04-02"), + new Tuple("Compute", "DiskRestorePoint", "2023-04-02"), + new Tuple("Compute", "Disks", "2023-04-02"), + new Tuple("Compute", "Galleries", "2022-03-03"), + new Tuple("Compute", "GalleryApplicationVersions", "2022-03-03"), + new Tuple("Compute", "GalleryApplications", "2022-03-03"), + new Tuple("Compute", "GalleryImageVersions", "2022-03-03"), + new Tuple("Compute", "GalleryImages", "2022-03-03"), + new Tuple("Compute", "GallerySharingProfile", "2022-03-03"), + new Tuple("Compute", "Images", "2023-07-01"), + new Tuple("Compute", "LogAnalytics", "2023-07-01"), + new Tuple("Compute", "Operations", "2023-07-01"), + new Tuple("Compute", "ProximityPlacementGroups", "2023-07-01"), + new Tuple("Compute", "ResourceSkus", "2021-07-01"), + new Tuple("Compute", "RestorePointCollections", "2023-07-01"), + new Tuple("Compute", "RestorePoints", "2023-07-01"), + new Tuple("Compute", "SharedGalleries", "2022-03-03"), + new Tuple("Compute", "SharedGalleryImageVersions", "2022-03-03"), + new Tuple("Compute", "SharedGalleryImages", "2022-03-03"), + new Tuple("Compute", "Snapshots", "2023-04-02"), + new Tuple("Compute", "SshPublicKeys", "2023-07-01"), + new Tuple("Compute", "Usage", "2023-07-01"), + new Tuple("Compute", "VirtualMachineExtensionImages", "2023-07-01"), + new Tuple("Compute", "VirtualMachineExtensions", "2023-07-01"), + new Tuple("Compute", "VirtualMachineImages", "2023-07-01"), + new Tuple("Compute", "VirtualMachineImagesEdgeZone", "2023-07-01"), + new Tuple("Compute", "VirtualMachineRunCommands", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMExtensions", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMRunCommands", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMs", "2023-07-01"), + new Tuple("Compute", "VirtualMachineScaleSets", "2023-07-01"), + new Tuple("Compute", "VirtualMachineSizes", "2023-07-01"), + new Tuple("Compute", "VirtualMachines", "2023-07-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperations.cs new file mode 100644 index 000000000000..1cb36dc80d0e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperations.cs @@ -0,0 +1,615 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleriesOperations operations. + /// + internal partial class SharedGalleriesOperations : IServiceOperations, ISharedGalleriesOperations + { + /// + /// Initializes a new instance of the SharedGalleriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleriesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperationsExtensions.cs new file mode 100644 index 000000000000..fbc46821ac94 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleriesOperationsExtensions.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleriesOperations. + /// + public static partial class SharedGalleriesOperationsExtensions + { + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleriesOperations operations, string location, string sharedTo = default(string)) + { + return operations.ListAsync(location, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleriesOperations operations, string location, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + public static SharedGallery Get(this ISharedGalleriesOperations operations, string location, string galleryUniqueName) + { + return operations.GetAsync(location, galleryUniqueName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleriesOperations operations, string location, string galleryUniqueName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared galleries by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperations.cs new file mode 100644 index 000000000000..9449c48ea63c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperations.cs @@ -0,0 +1,656 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImageVersionsOperations operations. + /// + internal partial class SharedGalleryImageVersionsOperations : IServiceOperations, ISharedGalleryImageVersionsOperations + { + /// + /// Initializes a new instance of the SharedGalleryImageVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleryImageVersionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + if (galleryImageVersionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageVersionName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("galleryImageVersionName", galleryImageVersionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + _url = _url.Replace("{galleryImageVersionName}", System.Uri.EscapeDataString(galleryImageVersionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..30ce93c9da32 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImageVersionsOperationsExtensions.cs @@ -0,0 +1,175 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleryImageVersionsOperations. + /// + public static partial class SharedGalleryImageVersionsOperationsExtensions + { + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string)) + { + return operations.ListAsync(location, galleryUniqueName, galleryImageName, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + public static SharedGalleryImageVersion Get(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName) + { + return operations.GetAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery image version by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The name of the gallery image version to be created. Needs to follow + /// semantic version name pattern: The allowed characters are digit and period. + /// Digits must be within the range of a 32-bit integer. Format: + /// <MajorVersion>.<MinorVersion>.<Patch> + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleryImageVersionsOperations operations, string location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleryImageVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery image versions by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleryImageVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperations.cs new file mode 100644 index 000000000000..551ff6fdcc26 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperations.cs @@ -0,0 +1,634 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SharedGalleryImagesOperations operations. + /// + internal partial class SharedGalleryImagesOperations : IServiceOperations, ISharedGalleryImagesOperations + { + /// + /// Initializes a new instance of the SharedGalleryImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SharedGalleryImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string galleryUniqueName, string sharedTo = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("sharedTo", sharedTo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (sharedTo != null) + { + _queryParameters.Add(string.Format("sharedTo={0}", System.Uri.EscapeDataString(sharedTo))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string galleryUniqueName, string galleryImageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (galleryUniqueName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryUniqueName"); + } + if (galleryImageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "galleryImageName"); + } + string apiVersion = "2022-03-03"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("galleryUniqueName", galleryUniqueName); + tracingParameters.Add("galleryImageName", galleryImageName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{galleryUniqueName}", System.Uri.EscapeDataString(galleryUniqueName)); + _url = _url.Replace("{galleryImageName}", System.Uri.EscapeDataString(galleryImageName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperationsExtensions.cs new file mode 100644 index 000000000000..6f7b97ca6e91 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SharedGalleryImagesOperationsExtensions.cs @@ -0,0 +1,155 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SharedGalleryImagesOperations. + /// + public static partial class SharedGalleryImagesOperationsExtensions + { + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + public static IPage List(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string sharedTo = default(string)) + { + return operations.ListAsync(location, galleryUniqueName, sharedTo).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The query parameter to decide what shared galleries to fetch when doing + /// listing operations. Possible values include: 'tenant' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string sharedTo = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, galleryUniqueName, sharedTo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + public static SharedGalleryImage Get(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string galleryImageName) + { + return operations.GetAsync(location, galleryUniqueName, galleryImageName).GetAwaiter().GetResult(); + } + + /// + /// Get a shared gallery image by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource location. + /// + /// + /// The unique name of the Shared Gallery. + /// + /// + /// The name of the Shared Gallery Image Definition from which the Image + /// Versions are to be listed. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISharedGalleryImagesOperations operations, string location, string galleryUniqueName, string galleryImageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, galleryUniqueName, galleryImageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISharedGalleryImagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List shared gallery images by subscription id or tenant id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISharedGalleryImagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperations.cs new file mode 100644 index 000000000000..5b6c71a3f426 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperations.cs @@ -0,0 +1,2112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SnapshotsOperations operations. + /// + internal partial class SnapshotsOperations : IServiceOperations, ISnapshotsOperations + { + /// + /// Initializes a new instance of the SnapshotsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SnapshotsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> GrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Snapshot snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (snapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); + } + if (snapshot != null) + { + snapshot.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("snapshot", snapshot); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(snapshot != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(snapshot, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (snapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("snapshot", snapshot); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(snapshot != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(snapshot, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginGrantAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + if (grantAccessData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grantAccessData"); + } + if (grantAccessData != null) + { + grantAccessData.Validate(); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("grantAccessData", grantAccessData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGrantAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(grantAccessData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(grantAccessData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRevokeAccessWithHttpMessagesAsync(string resourceGroupName, string snapshotName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (snapshotName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); + } + string apiVersion = "2023-04-02"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("snapshotName", snapshotName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevokeAccess", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{snapshotName}", System.Uri.EscapeDataString(snapshotName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperationsExtensions.cs new file mode 100644 index 000000000000..bf0a0eed6b9e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SnapshotsOperationsExtensions.cs @@ -0,0 +1,667 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SnapshotsOperations. + /// + public static partial class SnapshotsOperationsExtensions + { + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + public static Snapshot CreateOrUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot) + { + return operations.CreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + public static Snapshot Update(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot) + { + return operations.UpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + public static Snapshot Get(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + return operations.GetAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + public static void Delete(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.DeleteAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this ISnapshotsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISnapshotsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISnapshotsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISnapshotsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + public static AccessUri GrantAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData) + { + return operations.GrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task GrantAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + public static void RevokeAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.RevokeAccessAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task RevokeAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + public static Snapshot BeginCreateOrUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Put disk operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, Snapshot snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + public static Snapshot BeginUpdate(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot) + { + return operations.BeginUpdateAsync(resourceGroupName, snapshotName, snapshot).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Snapshot object supplied in the body of the Patch snapshot operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, SnapshotUpdate snapshot, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, snapshotName, snapshot, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + public static void BeginDelete(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.BeginDeleteAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + public static AccessUri BeginGrantAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData) + { + return operations.BeginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).GetAwaiter().GetResult(); + } + + /// + /// Grants access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// Access data object supplied in the body of the get snapshot access + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGrantAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, GrantAccessData grantAccessData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGrantAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, grantAccessData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + public static void BeginRevokeAccess(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName) + { + operations.BeginRevokeAccessAsync(resourceGroupName, snapshotName).GetAwaiter().GetResult(); + } + + /// + /// Revokes access to a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the snapshot that is being created. The name can't be changed + /// after the snapshot is created. Supported characters for the name are a-z, + /// A-Z, 0-9, _ and -. The max name length is 80 characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevokeAccessAsync(this ISnapshotsOperations operations, string resourceGroupName, string snapshotName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevokeAccessWithHttpMessagesAsync(resourceGroupName, snapshotName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperations.cs new file mode 100644 index 000000000000..122047f67150 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperations.cs @@ -0,0 +1,1767 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SshPublicKeysOperations operations. + /// + internal partial class SshPublicKeysOperations : IServiceOperations, ISshPublicKeysOperations + { + /// + /// Initializes a new instance of the SshPublicKeysOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SshPublicKeysOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GenerateKeyPairWithHttpMessagesAsync(string resourceGroupName, string sshPublicKeyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sshPublicKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sshPublicKeyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sshPublicKeyName", sshPublicKeyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateKeyPair", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sshPublicKeyName}", System.Uri.EscapeDataString(sshPublicKeyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperationsExtensions.cs new file mode 100644 index 000000000000..e2f5a40ebee0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/SshPublicKeysOperationsExtensions.cs @@ -0,0 +1,378 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SshPublicKeysOperations. + /// + public static partial class SshPublicKeysOperationsExtensions + { + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this ISshPublicKeysOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ISshPublicKeysOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this ISshPublicKeysOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISshPublicKeysOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + public static SshPublicKeyResource Create(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters) + { + return operations.CreateAsync(resourceGroupName, sshPublicKeyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to create the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + public static SshPublicKeyResource Update(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters) + { + return operations.UpdateAsync(resourceGroupName, sshPublicKeyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a new SSH public key resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// Parameters supplied to update the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, SshPublicKeyUpdateResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static void Delete(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + operations.DeleteAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// Delete an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static SshPublicKeyResource Get(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + return operations.GetAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + public static SshPublicKeyGenerateKeyPairResult GenerateKeyPair(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName) + { + return operations.GenerateKeyPairAsync(resourceGroupName, sshPublicKeyName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the SSH public key. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateKeyPairAsync(this ISshPublicKeysOperations operations, string resourceGroupName, string sshPublicKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateKeyPairWithHttpMessagesAsync(resourceGroupName, sshPublicKeyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ISshPublicKeysOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink + /// property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ISshPublicKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISshPublicKeysOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the SSH public keys in the specified resource group. Use the + /// nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISshPublicKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/UsageOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/UsageOperations.cs new file mode 100644 index 000000000000..946d6c3632f8 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/UsageOperations.cs @@ -0,0 +1,423 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsageOperations operations. + /// + internal partial class UsageOperations : IServiceOperations, IUsageOperations + { + /// + /// Initializes a new instance of the UsageOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsageOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/UsageOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/UsageOperationsExtensions.cs new file mode 100644 index 000000000000..39b3384749f1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/UsageOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UsageOperations. + /// + public static partial class UsageOperationsExtensions + { + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + public static IPage List(this IUsageOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IUsageOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IUsageOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets, for the specified location, the current compute resource usage + /// information as well as the limits for compute resources under the + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IUsageOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperations.cs new file mode 100644 index 000000000000..139c7cb383a9 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperations.cs @@ -0,0 +1,670 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineExtensionImagesOperations operations. + /// + internal partial class VirtualMachineExtensionImagesOperations : IServiceOperations, IVirtualMachineExtensionImagesOperations + { + /// + /// Initializes a new instance of the VirtualMachineExtensionImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a virtual machine extension image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publisherName, string type, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("type", type); + tracingParameters.Add("version", version); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListTypesWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListTypes", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListVersionsWithHttpMessagesAsync(string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("type", type); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVersions", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{type}", System.Uri.EscapeDataString(type)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs new file mode 100644 index 000000000000..8677d2b14eaa --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionImagesOperationsExtensions.cs @@ -0,0 +1,160 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineExtensionImagesOperations. + /// + public static partial class VirtualMachineExtensionImagesOperationsExtensions + { + /// + /// Gets a virtual machine extension image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + public static VirtualMachineExtensionImage Get(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, string version) + { + return operations.GetAsync(location, publisherName, type, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine extension image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publisherName, type, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + public static IList ListTypes(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName) + { + return operations.ListTypesAsync(location, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine extension image types. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListTypesAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListTypesWithHttpMessagesAsync(location, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + public static IList ListVersions(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListVersionsAsync(location, publisherName, type, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine extension image versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// + /// + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVersionsAsync(this IVirtualMachineExtensionImagesOperations operations, string location, string publisherName, string type, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVersionsWithHttpMessagesAsync(location, publisherName, type, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperations.cs new file mode 100644 index 000000000000..acf0c67f2dc1 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperations.cs @@ -0,0 +1,1188 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineExtensionsOperations operations. + /// + internal partial class VirtualMachineExtensionsOperations : IServiceOperations, IVirtualMachineExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperationsExtensions.cs new file mode 100644 index 000000000000..c63a4d94c60e --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineExtensionsOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineExtensionsOperations. + /// + public static partial class VirtualMachineExtensionsOperationsExtensions + { + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension Update(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + public static void Delete(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmName, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtension Get(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmName, vmExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtensionsListResult List(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, vmName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all extensions of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be created or + /// updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginUpdate(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be updated. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + public static void BeginDelete(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmName, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the extension should be deleted. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineExtensionsOperations operations, string resourceGroupName, string vmName, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperations.cs new file mode 100644 index 000000000000..acb14931fb46 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperations.cs @@ -0,0 +1,1143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineImagesEdgeZoneOperations operations. + /// + internal partial class VirtualMachineImagesEdgeZoneOperations : IServiceOperations, IVirtualMachineImagesEdgeZoneOperations + { + /// + /// Initializes a new instance of the VirtualMachineImagesEdgeZoneOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineImagesEdgeZoneOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("version", version); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("expand", expand); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOffersWithHttpMessagesAsync(string location, string edgeZone, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOffers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListPublishersWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPublishers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusWithHttpMessagesAsync(string location, string edgeZone, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs new file mode 100644 index 000000000000..b7c0df8deb58 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesEdgeZoneOperationsExtensions.cs @@ -0,0 +1,315 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineImagesEdgeZoneOperations. + /// + public static partial class VirtualMachineImagesEdgeZoneOperationsExtensions + { + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + public static VirtualMachineImage Get(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version) + { + return operations.GetAsync(location, edgeZone, publisherName, offer, skus, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + public static IList List(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string)) + { + return operations.ListAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, edge zone, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// An integer value specifying the number of images to return that matches + /// supplied values. + /// + /// + /// Specifies the order of the results returned. Formatted as an OData query. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + public static IList ListOffers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName) + { + return operations.ListOffersAsync(location, edgeZone, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image offers for the specified location, + /// edge zone and publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOffersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOffersWithHttpMessagesAsync(location, edgeZone, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + public static IList ListPublishers(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone) + { + return operations.ListPublishersAsync(location, edgeZone).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location and edge zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPublishersAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPublishersWithHttpMessagesAsync(location, edgeZone, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + public static IList ListSkus(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer) + { + return operations.ListSkusAsync(location, edgeZone, publisherName, offer).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge + /// zone, publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineImagesEdgeZoneOperations operations, string location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(location, edgeZone, publisherName, offer, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperations.cs new file mode 100644 index 000000000000..8bb4fde94373 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperations.cs @@ -0,0 +1,1290 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineImagesOperations operations. + /// + internal partial class VirtualMachineImagesOperations : IServiceOperations, IVirtualMachineImagesOperations + { + /// + /// Initializes a new instance of the VirtualMachineImagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineImagesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets a virtual machine image. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("version", version); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (skus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "skus"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("skus", skus); + tracingParameters.Add("expand", expand); + tracingParameters.Add("top", top); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{skus}", System.Uri.EscapeDataString(skus)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOffersWithHttpMessagesAsync(string location, string publisherName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOffers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListPublishersWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPublishers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusWithHttpMessagesAsync(string location, string publisherName, string offer, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (publisherName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherName"); + } + if (offer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offer"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("publisherName", publisherName); + tracingParameters.Add("offer", offer); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{publisherName}", System.Uri.EscapeDataString(publisherName)); + _url = _url.Replace("{offer}", System.Uri.EscapeDataString(offer)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all virtual machine image versions for the specified edge + /// zone + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByEdgeZoneWithHttpMessagesAsync(string location, string edgeZone, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (edgeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "edgeZone"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("edgeZone", edgeZone); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByEdgeZone", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{edgeZone}", System.Uri.EscapeDataString(edgeZone)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperationsExtensions.cs new file mode 100644 index 000000000000..158f9763f344 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineImagesOperationsExtensions.cs @@ -0,0 +1,321 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineImagesOperations. + /// + public static partial class VirtualMachineImagesOperationsExtensions + { + /// + /// Gets a virtual machine image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + public static VirtualMachineImage Get(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string version) + { + return operations.GetAsync(location, publisherName, offer, skus, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine image. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// A valid image SKU version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, publisherName, offer, skus, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + public static IList List(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string)) + { + return operations.ListAsync(location, publisherName, offer, skus, expand, top, orderby).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified + /// location, publisher, offer, and SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// A valid image SKU. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, string skus, string expand = default(string), int? top = default(int?), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, publisherName, offer, skus, expand, top, orderby, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + public static IList ListOffers(this IVirtualMachineImagesOperations operations, string location, string publisherName) + { + return operations.ListOffersAsync(location, publisherName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image offers for the specified location and + /// publisher. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOffersAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOffersWithHttpMessagesAsync(location, publisherName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + public static IList ListPublishers(this IVirtualMachineImagesOperations operations, string location) + { + return operations.ListPublishersAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPublishersAsync(this IVirtualMachineImagesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPublishersWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + public static IList ListSkus(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer) + { + return operations.ListSkusAsync(location, publisherName, offer).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, + /// publisher, and offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// A valid image publisher. + /// + /// + /// A valid image publisher offer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineImagesOperations operations, string location, string publisherName, string offer, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(location, publisherName, offer, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified edge + /// zone + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + public static VmImagesInEdgeZoneListResult ListByEdgeZone(this IVirtualMachineImagesOperations operations, string location, string edgeZone) + { + return operations.ListByEdgeZoneAsync(location, edgeZone).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machine image versions for the specified edge + /// zone + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a supported Azure region. + /// + /// + /// The name of the edge zone. + /// + /// + /// The cancellation token. + /// + public static async Task ListByEdgeZoneAsync(this IVirtualMachineImagesOperations operations, string location, string edgeZone, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByEdgeZoneWithHttpMessagesAsync(location, edgeZone, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperations.cs new file mode 100644 index 000000000000..c704df3bed4c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperations.cs @@ -0,0 +1,1927 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineRunCommandsOperations operations. + /// + internal partial class VirtualMachineRunCommandsOperations : IServiceOperations, IVirtualMachineRunCommandsOperations + { + /// + /// Initializes a new instance of the VirtualMachineRunCommandsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string location, string commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (commandId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "commandId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("commandId", commandId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{commandId}", System.Uri.EscapeDataString(commandId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByVirtualMachine", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string vmName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVirtualMachine", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (runCommand == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommand"); + } + if (runCommand != null) + { + runCommand.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("runCommand", runCommand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(runCommand != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(runCommand, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (runCommand == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommand"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("runCommand", runCommand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(runCommand != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(runCommand, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByVirtualMachineNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVirtualMachineNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperationsExtensions.cs new file mode 100644 index 000000000000..6d22f626f7e2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineRunCommandsOperationsExtensions.cs @@ -0,0 +1,563 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineRunCommandsOperations. + /// + public static partial class VirtualMachineRunCommandsOperationsExtensions + { + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + public static IPage List(this IVirtualMachineRunCommandsOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineRunCommandsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + public static RunCommandDocument Get(this IVirtualMachineRunCommandsOperations operations, string location, string commandId) + { + return operations.GetAsync(location, commandId).GetAwaiter().GetResult(); + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which run commands is queried. + /// + /// + /// The command id. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineRunCommandsOperations operations, string location, string commandId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(location, commandId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand CreateOrUpdate(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand Update(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand) + { + return operations.UpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + public static void Delete(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName) + { + operations.DeleteAsync(resourceGroupName, vmName, runCommandName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineRunCommand GetByVirtualMachine(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, string expand = default(string)) + { + return operations.GetByVirtualMachineAsync(resourceGroupName, vmName, runCommandName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetByVirtualMachineAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByVirtualMachineWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The expand expression to apply on the operation. + /// + public static IPage ListByVirtualMachine(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string expand = default(string)) + { + return operations.ListByVirtualMachineAsync(resourceGroupName, vmName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine containing the run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByVirtualMachineAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVirtualMachineWithHttpMessagesAsync(resourceGroupName, vmName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand BeginCreateOrUpdate(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be created or + /// updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommand runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand BeginUpdate(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand) + { + return operations.BeginUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be updated. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, VirtualMachineRunCommandUpdate runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + public static void BeginDelete(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName) + { + operations.BeginDeleteAsync(resourceGroupName, vmName, runCommandName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine where the run command should be deleted. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineRunCommandsOperations operations, string resourceGroupName, string vmName, string runCommandName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, runCommandName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineRunCommandsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachineRunCommandsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByVirtualMachineNext(this IVirtualMachineRunCommandsOperations operations, string nextPageLink) + { + return operations.ListByVirtualMachineNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all run commands of a Virtual Machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByVirtualMachineNextAsync(this IVirtualMachineRunCommandsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVirtualMachineNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperations.cs new file mode 100644 index 000000000000..c852abd706fd --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperations.cs @@ -0,0 +1,1371 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetExtensionsOperations operations. + /// + internal partial class VirtualMachineScaleSetExtensionsOperations : IServiceOperations, IVirtualMachineScaleSetExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update an extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (vmssExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmssExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmssExtensionName", vmssExtensionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{vmssExtensionName}", System.Uri.EscapeDataString(vmssExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs new file mode 100644 index 000000000000..b654ec5c3eb3 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetExtensionsOperationsExtensions.cs @@ -0,0 +1,449 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetExtensionsOperations. + /// + public static partial class VirtualMachineScaleSetExtensionsOperationsExtensions + { + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension CreateOrUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension Update(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + public static void Delete(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineScaleSetExtension Get(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + public static IPage List(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set containing the extension. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Create VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + public static VirtualMachineScaleSetExtension BeginUpdate(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update an extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be updated. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// Parameters supplied to the Update VM scale set Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachineScaleSetExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + public static void BeginDelete(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be deleted. + /// + /// + /// The name of the VM scale set extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string vmssExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetExtensionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all extensions in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachineScaleSetExtensionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs new file mode 100644 index 000000000000..869b71db791c --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs @@ -0,0 +1,841 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetRollingUpgradesOperations operations. + /// + internal partial class VirtualMachineScaleSetRollingUpgradesOperations : IServiceOperations, IVirtualMachineScaleSetRollingUpgradesOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetRollingUpgradesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetLatestWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLatest", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginCancelWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCancel", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartOSUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartOSUpgrade", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartExtensionUpgradeWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartExtensionUpgrade", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs new file mode 100644 index 000000000000..8bcea9e3f765 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetRollingUpgradesOperationsExtensions.cs @@ -0,0 +1,303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetRollingUpgradesOperations. + /// + public static partial class VirtualMachineScaleSetRollingUpgradesOperationsExtensions + { + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void Cancel(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.CancelAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void StartOSUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.StartOSUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task StartOSUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void StartExtensionUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.StartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task StartExtensionUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static RollingUpgradeStatusInfo GetLatest(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetLatestAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of the latest virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetLatestAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLatestWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginCancel(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginCancelAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the current virtual machine scale set rolling upgrade. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCancelAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginStartOSUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Starts a rolling upgrade to move all virtual machine scale set instances to + /// the latest available Platform Image OS version. Instances which are already + /// running the latest available OS version are not affected. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartOSUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static void BeginStartExtensionUpgrade(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName) + { + operations.BeginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartExtensionUpgradeAsync(this IVirtualMachineScaleSetRollingUpgradesOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartExtensionUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 000000000000..b40235f940ae --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,1241 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMExtensionsOperations : IServiceOperations, IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs new file mode 100644 index 000000000000..2bd9dea48e92 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs @@ -0,0 +1,467 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMExtensionsOperations. + /// + public static partial class VirtualMachineScaleSetVMExtensionsOperationsExtensions + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineScaleSetVMExtension CreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineScaleSetVMExtension Update(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineScaleSetVMExtension Get(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineScaleSetVMExtensionsListResult List(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineScaleSetVMExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineScaleSetVMExtension BeginUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVMExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperations.cs new file mode 100644 index 000000000000..89327ce9d3c2 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperations.cs @@ -0,0 +1,1415 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMRunCommandsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMRunCommandsOperations : IServiceOperations, IVirtualMachineScaleSetVMRunCommandsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMRunCommandsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMRunCommandsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (runCommand == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommand"); + } + if (runCommand != null) + { + runCommand.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("runCommand", runCommand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(runCommand != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(runCommand, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (runCommand == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommand"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("runCommand", runCommand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(runCommand != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(runCommand, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (runCommandName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "runCommandName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("runCommandName", runCommandName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{runCommandName}", System.Uri.EscapeDataString(runCommandName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperationsExtensions.cs new file mode 100644 index 000000000000..ed637e5e47df --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMRunCommandsOperationsExtensions.cs @@ -0,0 +1,503 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMRunCommandsOperations. + /// + public static partial class VirtualMachineScaleSetVMRunCommandsOperationsExtensions + { + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand CreateOrUpdate(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand Update(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + public static void Delete(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineRunCommand Get(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + public static IPage List(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand BeginCreateOrUpdate(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Create Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommand runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + public static VirtualMachineRunCommand BeginUpdate(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// Parameters supplied to the Update Virtual Machine RunCommand operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, VirtualMachineRunCommandUpdate runCommand, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM run command. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine run command. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string runCommandName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all run commands of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachineScaleSetVMRunCommandsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperations.cs new file mode 100644 index 000000000000..36c8fc160881 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperations.cs @@ -0,0 +1,3695 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMsOperations : IServiceOperations, IVirtualMachineScaleSetVMsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the instance view of the virtual machine. 'UserData' will retrieve + /// the UserData of the virtual machine. Possible values include: + /// 'instanceView', 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualMachineScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("virtualMachineScaleSetName", virtualMachineScaleSetName); + tracingParameters.Add("select", select); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualMachineScaleSetName}", System.Uri.EscapeDataString(virtualMachineScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("sasUriExpirationTimeInMinutes", sasUriExpirationTimeInMinutes); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RetrieveBootDiagnosticsData", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (sasUriExpirationTimeInMinutes != null) + { + _queryParameters.Add(string.Format("sasUriExpirationTimeInMinutes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sasUriExpirationTimeInMinutes, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SimulateEviction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmScaleSetVMReimageInput", vmScaleSetVMReimageInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmScaleSetVMReimageInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmScaleSetVMReimageInput, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimageAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("forceDeletion", forceDeletion); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (forceDeletion != null) + { + _queryParameters.Add(string.Format("forceDeletion={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDeletion, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("skipShutdown", skipShutdown); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPowerOff", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRunCommand", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs new file mode 100644 index 000000000000..b35353778576 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -0,0 +1,1387 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMsOperations. + /// + public static partial class VirtualMachineScaleSetVMsOperationsExtensions + { + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + public static void Reimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters)) + { + operations.ReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void ReimageAll(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.ReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAllAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Deallocate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.DeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + public static VirtualMachineScaleSetVM Update(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the instance view of the virtual machine. 'UserData' will retrieve + /// the UserData of the virtual machine. Possible values include: + /// 'instanceView', 'userData' + /// + public static VirtualMachineScaleSetVM Get(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' will + /// retrieve the instance view of the virtual machine. 'UserData' will retrieve + /// the UserData of the virtual machine. Possible values include: + /// 'instanceView', 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static VirtualMachineScaleSetVMInstanceView GetInstanceView(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + return operations.GetInstanceViewAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + public static IPage List(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string)) + { + return operations.ListAsync(resourceGroupName, virtualMachineScaleSetName, odataQuery, select).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The list parameters. Allowed values are 'instanceView', + /// 'instanceView/statuses'. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string virtualMachineScaleSetName, ODataQuery odataQuery = default(ODataQuery), string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, virtualMachineScaleSetName, odataQuery, select, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void PowerOff(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false) + { + operations.PowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Restart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.RestartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Start(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.StartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void Redeploy(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.RedeployAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + public static RetrieveBootDiagnosticsDataResult RetrieveBootDiagnosticsData(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?)) + { + return operations.RetrieveBootDiagnosticsDataAsync(resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes).GetAwaiter().GetResult(); + } + + /// + /// The operation to retrieve SAS URIs of boot diagnostic logs for a virtual + /// machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + /// + /// The cancellation token. + /// + public static async Task RetrieveBootDiagnosticsDataAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, int? sasUriExpirationTimeInMinutes = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RetrieveBootDiagnosticsDataWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void PerformMaintenance(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void SimulateEviction(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.SimulateEvictionAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task SimulateEvictionAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SimulateEvictionWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult RunCommand(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters) + { + return operations.RunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task RunCommandAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + public static void BeginReimage(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters)) + { + operations.BeginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a specific virtual machine in a VM + /// scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters for the Reimaging Virtual machine in ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginReimageAll(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Allows you to re-image all the disks ( including data disks ) in the a VM + /// scale set instance. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAllAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginDeallocate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Deallocates a specific virtual machine in a VM scale set. Shuts down the + /// virtual machine and releases the compute resources it uses. You are not + /// billed for the compute resources of this virtual machine once it is + /// deallocated. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + public static VirtualMachineScaleSetVM BeginUpdate(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a virtual machine of a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set where the extension should be create or + /// updated. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, VirtualMachineScaleSetVM parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a virtual machine from a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Optional parameter to force delete a virtual machine from a VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void BeginPowerOff(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false) + { + operations.BeginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) a virtual machine in a VM scale set. Note that resources + /// are still attached and you are getting charged for the resources. Instead, + /// use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginRestart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginRestartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Restarts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginStart(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginStartAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Starts a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginRedeploy(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + public static void BeginPerformMaintenance(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Performs maintenance on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult BeginRunCommand(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters) + { + return operations.BeginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on a virtual machine in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRunCommandAsync(this IVirtualMachineScaleSetVMsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetVMsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all virtual machines in a VM scale sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachineScaleSetVMsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperations.cs new file mode 100644 index 000000000000..73e474f6ac54 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperations.cs @@ -0,0 +1,6031 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetsOperations operations. + /// + internal partial class VirtualMachineScaleSetsOperations : IServiceOperations, IVirtualMachineScaleSetsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The expand expression to apply on the operation. 'UserData' retrieves the + /// UserData property of the VM scale set that was provided by the user during + /// the VM scale set Create/Update operation. Possible values include: + /// 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetInstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetInstanceView", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetOSUpgradeHistoryWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOSUpgradeHistory", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task UpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + /// + /// The zone in which the manual recovery walk is requested for cross zone + /// virtual machine scale set + /// + /// + /// The placement group id for which the manual recovery walk is requested. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, string zone = default(string), string placementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("platformUpdateDomain", platformUpdateDomain); + tracingParameters.Add("zone", zone); + tracingParameters.Add("placementGroupId", placementGroupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + _queryParameters.Add(string.Format("platformUpdateDomain={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(platformUpdateDomain, Client.SerializationSettings).Trim('"')))); + if (zone != null) + { + _queryParameters.Add(string.Format("zone={0}", System.Uri.EscapeDataString(zone))); + } + if (placementGroupId != null) + { + _queryParameters.Add(string.Format("placementGroupId={0}", System.Uri.EscapeDataString(placementGroupId))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ConvertToSinglePlacementGroupWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VMScaleSetConvertToSinglePlacementGroupInput parameters = new VMScaleSetConvertToSinglePlacementGroupInput(); + if (activePlacementGroupId != null) + { + parameters.ActivePlacementGroupId = activePlacementGroupId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ConvertToSinglePlacementGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task SetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginSetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (forceDeletion != null) + { + _queryParameters.Add(string.Format("forceDeletion={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDeletion, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("hibernate", hibernate); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (hibernate != null) + { + _queryParameters.Add(string.Format("hibernate={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(hibernate, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (instanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + if (instanceIds != null) + { + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("forceDeletion", forceDeletion); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteInstances", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (forceDeletion != null) + { + _queryParameters.Add(string.Format("forceDeletion={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDeletion, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("skipShutdown", skipShutdown); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPowerOff", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReapply", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginUpdateInstancesWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (instanceIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + if (instanceIds != null) + { + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateInstances", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("vmScaleSetReimageInput", vmScaleSetReimageInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmScaleSetReimageInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmScaleSetReimageInput, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageAllWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); + if (instanceIds != null) + { + vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); + vmInstanceIDs.InstanceIds = instanceIds; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vmInstanceIDs", vmInstanceIDs); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimageAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(vmInstanceIDs != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vmInstanceIDs, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginSetOrchestrationServiceStateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginSetOrchestrationServiceState", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkusNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetOSUpgradeHistoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOSUpgradeHistoryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperationsExtensions.cs new file mode 100644 index 000000000000..ea09d0173cf0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineScaleSetsOperationsExtensions.cs @@ -0,0 +1,2054 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetsOperations. + /// + public static partial class VirtualMachineScaleSetsOperationsExtensions + { + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + public static IPage ListByLocation(this IVirtualMachineScaleSetsOperations operations, string location) + { + return operations.ListByLocationAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IVirtualMachineScaleSetsOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet CreateOrUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet Update(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void Delete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The expand expression to apply on the operation. 'UserData' retrieves the + /// UserData property of the VM scale set that was provided by the user during + /// the VM scale set Create/Update operation. Possible values include: + /// 'userData' + /// + public static VirtualMachineScaleSet Get(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, expand).GetAwaiter().GetResult(); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The expand expression to apply on the operation. 'UserData' retrieves the + /// UserData property of the VM scale set that was provided by the user during + /// the VM scale set Create/Update operation. Possible values include: + /// 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + public static void Deallocate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList)) + { + operations.DeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void DeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) + { + operations.DeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static VirtualMachineScaleSetInstanceView GetInstanceView(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetInstanceViewAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task GetInstanceViewAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this IVirtualMachineScaleSetsOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IVirtualMachineScaleSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static IPage ListSkus(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.ListSkusAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static IPage GetOSUpgradeHistory(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.GetOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task> GetOSUpgradeHistoryAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSUpgradeHistoryWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + public static void PowerOff(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList)) + { + operations.PowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void Restart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.RestartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void Start(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.StartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static VirtualMachineScaleSetsReapplyHeaders Reapply(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.ReapplyAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task ReapplyAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ReapplyWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void Redeploy(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.RedeployAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void PerformMaintenance(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + public static void UpdateInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + { + operations.UpdateInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + public static void Reimage(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters)) + { + operations.ReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void ReimageAll(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.ReimageAllAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAllAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + /// + /// The zone in which the manual recovery walk is requested for cross zone + /// virtual machine scale set + /// + /// + /// The placement group id for which the manual recovery walk is requested. + /// + public static RecoveryWalkResponse ForceRecoveryServiceFabricPlatformUpdateDomainWalk(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, string zone = default(string), string placementGroupId = default(string)) + { + return operations.ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId).GetAwaiter().GetResult(); + } + + /// + /// Manual platform update domain walk to update virtual machines in a service + /// fabric virtual machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The platform update domain for which a manual recovery walk is requested + /// + /// + /// The zone in which the manual recovery walk is requested for cross zone + /// virtual machine scale set + /// + /// + /// The placement group id for which the manual recovery walk is requested. + /// + /// + /// The cancellation token. + /// + public static async Task ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, int platformUpdateDomain, string zone = default(string), string placementGroupId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ForceRecoveryServiceFabricPlatformUpdateDomainWalkWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + public static void ConvertToSinglePlacementGroup(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string)) + { + operations.ConvertToSinglePlacementGroupAsync(resourceGroupName, vmScaleSetName, activePlacementGroupId).GetAwaiter().GetResult(); + } + + /// + /// Converts SinglePlacementGroup property to false for a existing virtual + /// machine scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// Id of the placement group in which you want future virtual machine + /// instances to be placed. To query placement group Id, please use Virtual + /// Machine Scale Set VMs - Get API. If not provided, the platform will choose + /// one with maximum number of virtual machine instances. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertToSinglePlacementGroupAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, string activePlacementGroupId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ConvertToSinglePlacementGroupWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, activePlacementGroupId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + public static void SetOrchestrationServiceState(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters) + { + operations.SetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The cancellation token. + /// + public static async Task SetOrchestrationServiceStateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet BeginCreateOrUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + public static VirtualMachineScaleSet BeginUpdate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set to create or update. + /// + /// + /// The scale set object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + public static void BeginDelete(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to force delete a VM scale set. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + public static void BeginDeallocate(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList)) + { + operations.BeginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Deallocates specific virtual machines in a VM scale set. Shuts down the + /// virtual machines and releases the compute resources. You are not billed for + /// the compute resources that this virtual machine scale set deallocates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Optional parameter to hibernate a virtual machine from the VM scale set. + /// (This feature is available for VMSS with Flexible OrchestrationMode only) + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? hibernate = default(bool?), IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// Deletes virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// Optional parameter to force delete virtual machines from the VM scale set. + /// (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + public static void BeginPowerOff(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList)) + { + operations.BeginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Power off (stop) one or more virtual machines in a VM scale set. Note that + /// resources are still attached and you are getting charged for the resources. + /// Instead, use deallocate to release resources and avoid charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, bool? skipShutdown = false, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, skipShutdown, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void BeginRestart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginRestartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void BeginStart(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginStartAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Starts one or more virtual machines in a VM scale set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + public static VirtualMachineScaleSetsReapplyHeaders BeginReapply(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName) + { + return operations.BeginReapplyAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult(); + } + + /// + /// Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the + /// Virtual Machine Instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReapplyAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void BeginRedeploy(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginRedeployAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void BeginPerformMaintenance(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Perform maintenance on one or more virtual machines in a VM scale set. + /// Operation on instances which are not eligible for perform maintenance will + /// be failed. Please refer to best practices for more details: + /// https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + public static void BeginUpdateInstances(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds) + { + operations.BeginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Upgrades one or more virtual machines to the latest SKU set in the VM scale + /// set model. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The virtual machine scale set instance ids. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateInstancesAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginUpdateInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + public static void BeginReimage(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters)) + { + operations.BeginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) one or more virtual machines in a + /// VM scale set which don't have a ephemeral OS disk, for virtual machines who + /// have a ephemeral OS disk the virtual machine is reset to initial state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// Parameters for Reimaging VM ScaleSet. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = default(VirtualMachineScaleSetReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + public static void BeginReimageAll(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList)) + { + operations.BeginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult(); + } + + /// + /// Reimages all the disks ( including data disks ) in the virtual machines in + /// a VM scale set. This operation is only supported for managed disks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAllAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageAllWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + public static void BeginSetOrchestrationServiceState(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters) + { + operations.BeginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Changes ServiceState property for a given service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine scale set to create or update. + /// + /// + /// The input object for SetOrchestrationServiceState API. + /// + /// + /// The cancellation token. + /// + public static async Task BeginSetOrchestrationServiceStateAsync(this IVirtualMachineScaleSetsOperations operations, string resourceGroupName, string vmScaleSetName, OrchestrationServiceStateInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginSetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM scale sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the + /// associated resource group. Use nextLink property in the response to get the + /// next page of VM Scale Sets. Do this till nextLink is null to fetch all the + /// VM Scale Sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListSkusNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.ListSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SKUs available for your VM scale set, including the minimum + /// and maximum VM instances allowed for each SKU. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetOSUpgradeHistoryNext(this IVirtualMachineScaleSetsOperations operations, string nextPageLink) + { + return operations.GetOSUpgradeHistoryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets list of OS upgrades on a VM scale set instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetOSUpgradeHistoryNextAsync(this IVirtualMachineScaleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOSUpgradeHistoryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperations.cs new file mode 100644 index 000000000000..161ce35b87b6 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperations.cs @@ -0,0 +1,247 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineSizesOperations operations. + /// + internal partial class VirtualMachineSizesOperations : IServiceOperations, IVirtualMachineSizesOperations + { + /// + /// Initializes a new instance of the VirtualMachineSizesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineSizesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperationsExtensions.cs new file mode 100644 index 000000000000..84a3b5d2dce0 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachineSizesOperationsExtensions.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineSizesOperations. + /// + public static partial class VirtualMachineSizesOperationsExtensions + { + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static IEnumerable List(this IVirtualMachineSizesOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// This API is deprecated. Use [Resources + /// Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachineSizesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperations.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperations.cs new file mode 100644 index 000000000000..46ff437323ab --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperations.cs @@ -0,0 +1,5777 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachinesOperations operations. + /// + internal partial class VirtualMachinesOperations : IServiceOperations, IVirtualMachinesOperations + { + /// + /// Initializes a new instance of the VirtualMachinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachinesOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the virtual machine that is managed + /// by the platform and can change outside of control plane operations. + /// 'UserData' retrieves the UserData property as part of the VM model view + /// that was provided by the user during the VM Create/Update operation. + /// Possible values include: 'instanceView', 'userData' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> InstanceViewWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "InstanceView", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? hibernate = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, hibernate, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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). + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task GeneralizeWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Generalize", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The name of the resource group. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllWithHttpMessagesAsync(string statusOnly = default(string), string filter = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statusOnly", statusOnly); + tracingParameters.Add("filter", filter); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (statusOnly != null) + { + _queryParameters.Add(string.Format("statusOnly={0}", System.Uri.EscapeDataString(statusOnly))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAvailableSizesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAvailableSizes", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> RetrieveBootDiagnosticsDataWithHttpMessagesAsync(string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("sasUriExpirationTimeInMinutes", sasUriExpirationTimeInMinutes); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RetrieveBootDiagnosticsData", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (sasUriExpirationTimeInMinutes != null) + { + _queryParameters.Add(string.Format("sasUriExpirationTimeInMinutes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sasUriExpirationTimeInMinutes, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task SimulateEvictionWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SimulateEviction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> AssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> InstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCaptureWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCapture", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachine parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("forceDeletion", forceDeletion); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (forceDeletion != null) + { + _queryParameters.Add(string.Format("forceDeletion={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDeletion, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginConvertToManagedDisksWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginConvertToManagedDisks", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeallocateWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? hibernate = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("hibernate", hibernate); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeallocate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (hibernate != null) + { + _queryParameters.Add(string.Format("hibernate={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(hibernate, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("skipShutdown", skipShutdown); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPowerOff", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (skipShutdown != null) + { + _queryParameters.Add(string.Format("skipShutdown={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipShutdown, Client.SerializationSettings).Trim('"')))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReapply", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRedeployWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRedeploy", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginReimageWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPerformMaintenanceWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPerformMaintenance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Assess patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginAssessPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAssessPatches", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Installs patches on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginInstallPatchesWithHttpMessagesAsync(string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (installPatchesInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "installPatchesInput"); + } + if (installPatchesInput != null) + { + installPatchesInput.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("installPatchesInput", installPatchesInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginInstallPatches", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(installPatchesInput != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(installPatchesInput, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Run command on the VM. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginRunCommandWithHttpMessagesAsync(string resourceGroupName, string vmName, RunCommandInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2023-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRunCommand", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs new file mode 100644 index 000000000000..6a1f4f6a07b7 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Generated/VirtualMachinesOperationsExtensions.cs @@ -0,0 +1,1953 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachinesOperations. + /// + public static partial class VirtualMachinesOperationsExtensions + { + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + public static IPage ListByLocation(this IVirtualMachinesOperations operations, string location) + { + return operations.ListByLocationAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IVirtualMachinesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + public static VirtualMachineCaptureResult Capture(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters) + { + return operations.CaptureAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task CaptureAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + public static VirtualMachine CreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + public static VirtualMachine Update(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + public static void Delete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) + { + operations.DeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the virtual machine that is managed + /// by the platform and can change outside of control plane operations. + /// 'UserData' retrieves the UserData property as part of the VM model view + /// that was provided by the user during the VM Create/Update operation. + /// Possible values include: 'instanceView', 'userData' + /// + public static VirtualMachine Get(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?)) + { + return operations.GetAsync(resourceGroupName, vmName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the model view or the instance view of a + /// virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. 'InstanceView' retrieves a + /// snapshot of the runtime properties of the virtual machine that is managed + /// by the platform and can change outside of control plane operations. + /// 'UserData' retrieves the UserData property as part of the VM model view + /// that was provided by the user during the VM Create/Update operation. + /// Possible values include: 'instanceView', 'userData' + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, InstanceViewTypes? expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineInstanceView InstanceView(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.InstanceViewAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves information about the run-time state of a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task InstanceViewAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InstanceViewWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void ConvertToManagedDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.ConvertToManagedDisksAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertToManagedDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + public static void Deallocate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? hibernate = default(bool?)) + { + operations.DeallocateAsync(resourceGroupName, vmName, hibernate).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task DeallocateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? hibernate = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeallocateWithHttpMessagesAsync(resourceGroupName, vmName, hibernate, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Generalize(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.GeneralizeAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// 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). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GeneralizeAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GeneralizeWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + public static IPage List(this IVirtualMachinesOperations operations, string resourceGroupName, string filter = default(string), string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, filter, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string filter = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, filter, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + public static IPage ListAll(this IVirtualMachinesOperations operations, string statusOnly = default(string), string filter = default(string), string expand = default(string)) + { + return operations.ListAllAsync(statusOnly, filter, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + /// + /// The system query option to filter VMs returned in the response. Allowed + /// value is 'virtualMachineScaleSet/id' eq + /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + /// + /// + /// The expand expression to apply on operation. 'instanceView' enables + /// fetching run time status of all Virtual Machines, this can only be + /// specified if a valid $filter option is specified. Possible values include: + /// 'instanceView' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IVirtualMachinesOperations operations, string statusOnly = default(string), string filter = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(statusOnly, filter, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static IEnumerable ListAvailableSizes(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.ListAvailableSizesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Lists all available virtual machine sizes to which the specified virtual + /// machine can be resized. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAvailableSizesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAvailableSizesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void PowerOff(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false) + { + operations.PowerOffAsync(resourceGroupName, vmName, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task PowerOffAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Reapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.ReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Restart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.RestartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Start(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.StartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Redeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.RedeployAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task RedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RedeployWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + public static void Reimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters)) + { + operations.ReimageAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + public static RetrieveBootDiagnosticsDataResult RetrieveBootDiagnosticsData(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?)) + { + return operations.RetrieveBootDiagnosticsDataAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes).GetAwaiter().GetResult(); + } + + /// + /// The operation to retrieve SAS URIs for a virtual machine's boot diagnostic + /// logs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Expiration duration in minutes for the SAS URIs with a value between 1 to + /// 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a + /// default expiration duration of 120 minutes. + /// + /// + /// The cancellation token. + /// + public static async Task RetrieveBootDiagnosticsDataAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, int? sasUriExpirationTimeInMinutes = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RetrieveBootDiagnosticsDataWithHttpMessagesAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void PerformMaintenance(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.PerformMaintenanceAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task PerformMaintenanceAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void SimulateEviction(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.SimulateEvictionAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to simulate the eviction of spot virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task SimulateEvictionAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SimulateEvictionWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineAssessPatchesResult AssessPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.AssessPatchesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task AssessPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult InstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.InstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task InstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult RunCommand(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters) + { + return operations.RunCommandAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task RunCommandAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + public static VirtualMachineCaptureResult BeginCapture(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters) + { + return operations.BeginCaptureAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Captures the VM by copying virtual hard disks of the VM and outputs a + /// template that can be used to create similar VMs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Capture Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCaptureAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineCaptureParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCaptureWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + public static VirtualMachine BeginCreateOrUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a virtual machine. Please note some + /// properties can be set only during virtual machine creation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Create Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachine parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + public static VirtualMachine BeginUpdate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Update Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + public static void BeginDelete(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?)) + { + operations.BeginDeleteAsync(resourceGroupName, vmName, forceDeletion).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to force delete virtual machines. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? forceDeletion = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmName, forceDeletion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginConvertToManagedDisks(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginConvertToManagedDisksAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Converts virtual machine disks from blob-based to managed disks. Virtual + /// machine must be stop-deallocated before invoking this operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginConvertToManagedDisksAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginConvertToManagedDisksWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + public static void BeginDeallocate(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? hibernate = default(bool?)) + { + operations.BeginDeallocateAsync(resourceGroupName, vmName, hibernate).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine and releases the compute resources. You are + /// not billed for the compute resources that this virtual machine uses. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Optional parameter to hibernate a virtual machine. (Feature in Preview) + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeallocateAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? hibernate = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeallocateWithHttpMessagesAsync(resourceGroupName, vmName, hibernate, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + public static void BeginPowerOff(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false) + { + operations.BeginPowerOffAsync(resourceGroupName, vmName, skipShutdown).GetAwaiter().GetResult(); + } + + /// + /// The operation to power off (stop) a virtual machine. The virtual machine + /// can be restarted with the same provisioned resources. You are still charged + /// for this virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The parameter to request non-graceful VM shutdown. True value for this flag + /// indicates non-graceful shutdown whereas false indicates otherwise. Default + /// value for this flag is false if not specified + /// + /// + /// The cancellation token. + /// + public static async Task BeginPowerOffAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, bool? skipShutdown = false, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginReapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRestart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginRestartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to restart a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginStart(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginStartAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to start a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginRedeploy(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginRedeployAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRedeployAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRedeployWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + public static void BeginReimage(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters)) + { + operations.BeginReimageAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Reimages (upgrade the operating system) a virtual machine which don't have + /// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the + /// virtual machine is reset to initial state. NOTE: The retaining of old OS + /// disk depends on the value of deleteOption of OS disk. If deleteOption is + /// detach, the old OS disk will be preserved after reimage. If deleteOption is + /// delete, the old OS disk will be deleted after reimage. The deleteOption of + /// the OS disk should be updated accordingly before performing the reimage. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Reimage Virtual Machine operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginPerformMaintenance(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginPerformMaintenanceAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to perform maintenance on a virtual machine. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPerformMaintenanceAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static VirtualMachineAssessPatchesResult BeginAssessPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + return operations.BeginAssessPatchesAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Assess patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginAssessPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginAssessPatchesWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + public static VirtualMachineInstallPatchesResult BeginInstallPatches(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput) + { + return operations.BeginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).GetAwaiter().GetResult(); + } + + /// + /// Installs patches on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Input for InstallPatches as directly received by the API + /// + /// + /// The cancellation token. + /// + public static async Task BeginInstallPatchesAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, VirtualMachineInstallPatchesParameters installPatchesInput, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginInstallPatchesWithHttpMessagesAsync(resourceGroupName, vmName, installPatchesInput, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + public static RunCommandResult BeginRunCommand(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters) + { + return operations.BeginRunCommandAsync(resourceGroupName, vmName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Run command on the VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Parameters supplied to the Run command operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRunCommandAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, RunCommandInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRunCommandWithHttpMessagesAsync(resourceGroupName, vmName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the virtual machines under the specified subscription for the + /// specified location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified resource group. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the + /// nextLink property in the response to get the next page of virtual machines. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this IVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Compute/Compute.Management.Sdk/Properties/AssemblyInfo.cs b/src/Compute/Compute.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..09d6db8c5703 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Compute SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("9d9ad6c2-c449-4f97-95d1-252f737c4e96")] + +[assembly: AssemblyVersion("6.2.0")] +[assembly: AssemblyFileVersion("6.2.0")] \ No newline at end of file diff --git a/src/Compute/Compute.Management.Sdk/README.md b/src/Compute/Compute.Management.Sdk/README.md new file mode 100644 index 000000000000..e10a07bad636 --- /dev/null +++ b/src/Compute/Compute.Management.Sdk/README.md @@ -0,0 +1,84 @@ +# Overall +This directory contains the service clients of Az.Compute module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@microsoft.azure/autorest.csharp@2.3.90 +autorest.cmd README.md --version=v2 +``` + +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +csharp: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION + +title: ComputeManagementClient +payload-flattening-threshold: 1 + +directive: + # dynamically add a DummyOrchestrationServiceName value to the enum + - from: virtualMachineScaleSet.json + where: $..enum + transform: >- + if( $.length === 1 && $[0] === "AutomaticRepairs") { + $.push('DummyOrchestrationServiceName'); + } + return $; + + # remove it from the C# generated code + - from: source-file-csharp + where: $ + transform: >- + return $. + replace(/.*public const string DummyOrchestrationServiceName.*/g,''). + replace(/, 'DummyOrchestrationServiceName'/g,''); + - from: gallery.json + where: $.definitions.GalleryTargetExtendedLocation.properties.storageAccountType["x-ms-enum"].name + transform: return "EdgeZoneStorageAccountType" +``` + + +### +``` yaml +commit: 1a925d1afe288a5f20d078bbc89214a36a0e4287 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/common-types/v1/common.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/computeRPCommon.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineScaleSet.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachine.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineImage.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineExtensionImage.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/availabilitySet.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/proximityPlacementGroup.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/dedicatedHost.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/sshPublicKey.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/image.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/restorePoint.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/capacityReservation.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/logAnalytic.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/runCommand.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/diskRPCommon.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/disk.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/diskAccess.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/diskEncryptionSet.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/diskRestorePoint.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/snapshot.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/skus.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/galleryRPCommon.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/gallery.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/sharedGallery.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/communityGallery.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/cloudService.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Compute +``` \ No newline at end of file diff --git a/src/Compute/Compute.sln b/src/Compute/Compute.sln index 3b66b2b22f74..67b9e55b199d 100644 --- a/src/Compute/Compute.sln +++ b/src/Compute/Compute.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29920.165 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute", "Compute\Compute.csproj", "{52643BD5-6378-49BD-9F6E-DAC9DD8A867B}" EndProject @@ -24,7 +24,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioTest.ResourceManage EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedServiceIdentity", "..\ManagedServiceIdentity\Az.ManagedServiceIdentity.csproj", "{9F6FD098-3A06-4D8F-9807-7E941FBCFEE4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ManagedServiceIdentity", "..\ManagedServiceIdentity\Az.ManagedServiceIdentity.csproj", "{9F6FD098-3A06-4D8F-9807-7E941FBCFEE4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute.Helpers", "Compute.Helpers\Compute.Helpers.csproj", "{6F441B7D-C614-42E0-A521-8C9C75E2A64F}" EndProject @@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadC EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Compute", "Compute.Autorest\Az.Compute.csproj", "{9C271BA4-C9F6-4736-995F-3D606FBCFDCC}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute.Management.Sdk", "Compute.Management.Sdk\Compute.Management.Sdk.csproj", "{99574727-29C1-42ED-A26B-13F396DBCA29}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,6 +102,10 @@ Global {9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C271BA4-C9F6-4736-995F-3D606FBCFDCC}.Release|Any CPU.Build.0 = Release|Any CPU + {99574727-29C1-42ED-A26B-13F396DBCA29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99574727-29C1-42ED-A26B-13F396DBCA29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99574727-29C1-42ED-A26B-13F396DBCA29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99574727-29C1-42ED-A26B-13F396DBCA29}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Compute/Compute/Az.Compute.psd1 b/src/Compute/Compute/Az.Compute.psd1 index 4e59e6c943ef..4faf78111d2d 100644 --- a/src/Compute/Compute/Az.Compute.psd1 +++ b/src/Compute/Compute/Az.Compute.psd1 @@ -57,8 +57,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.12.5'; }) # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.PowerShell.AutoMapper.dll', - 'Microsoft.Azure.Management.Compute.dll', +RequiredAssemblies = 'Microsoft.Azure.PowerShell.AutoMapper.dll', 'Microsoft.Azure.PowerShell.Compute.Management.Sdk.dll', 'Microsoft.WindowsAzure.Storage.dll', 'Microsoft.Azure.Management.ResourceGraph.dll', 'Compute.Autorest\bin\Az.Compute.private.dll', diff --git a/src/Compute/Compute/Compute.csproj b/src/Compute/Compute/Compute.csproj index 9ca56005cb63..c2033d39bfa3 100644 --- a/src/Compute/Compute/Compute.csproj +++ b/src/Compute/Compute/Compute.csproj @@ -15,7 +15,6 @@ - @@ -45,6 +44,7 @@ +